Start a new topic

3D lighting and material

3D lighting and material


Can you try the following: 

1. add a point light to the scene
2. set the color of that light to your preferred ambient light value
3. set it to invisible (i.e. disable the eye icon) in the scene graph view

Export the model to fbx and convert it with the encoder.

I had some problems loading of the wt3, but maybe it works with your version of the SDK. That is, no guarantee that it works.

A fix for the import problems is ready and will be available with the next release of the SDK.

Hey Roland,

Thanks a lot for the new workaround!
Unfortunately it didnt change anything, my object is still half-way dark/tinted no matter how I export it, with or without other light sources, hidden from viewport, hidden from rendering, the result is always the same. :(

I think that all of my lighting problems would immediately disappear if there was a chance to use more than just one light source. (i.e. placing a directional above and below)

Is there any planned date for the release of the SDK version that contains the fixed import methods?

Thank you and kind regards,

Marton

Sorry, I forgot one point. Try it with 

1. add a point light to the scene
2. set the color of that light to your preferred ambient light value
3. set Falloff: constant
3. set it to invisible (i.e. disable the eye icon) in the scene graph view

Please try again. 

Regarding the multi-lighting: I fully agree, but it will not be available soon. Sorry. If you need a more sophisticated 3D rendering you may consiter using the Wikitude Unity Plugin.

Dear Roland,

Thank you very much for your efforts on further helping me out, really appreciate it!
Among others I tried exactly this method, but unfortunately could not achieve any improvement on the lights.

Thank you and best regards,

Marton

If I open the fbx attached below with the encoder I see the 3D model without any black faces. You can see the settings in the blender file attached.

Dear Roland,

Thank you for the tip! Unfortunately it didn't help me.
I've been playing with the settings for hours now, but still couldn't achieve an evenly lit object in my cordova app.
The best I could make is the one I have linked above, when the lit side is perfect, but the other is dark.
Am I the only one who has problems with this? :)

I cannot switch to Unity as my app is created in Cordova, but I wonder if there was a way to make the export without any lights and add a single light source in the encoder or within javascript.
I wouldn't mind the dark half of the object if it doesn't rotate towards me... :)

Thank you and best regards,

Marton

 

I've been experimenting with lighting.

I create my file in Blender, with a single light source.  I export it as FBX, and bring it into the Wikitude 3D encoder.  No errors or warnings.

If find that if I use a point light, it has no effect -- the object is lit uniformly, the same as if I don't have the point source there.  The scene hierarchy display does show my point light source.

If I use a directional light (i.e. "sun" in Blender), it works -- but of course, half of my object is black because it receives no light.  This is a problem, since I animate the rotation (i.e. heading) of the object at runtime.

Am I overlooking something?

 

Maybe I found the reason why it didn't work for you: I realize that the order of light sources matters. 

As you hopefully can see, the order used in the blender attachment in my previous posting provides the lighting and ambient light expected in the encoder. 

I adjusted the encoder accordingly. So in the next release of the SDK 5.2 and the encoder 1.6 the order of the light sources will not matter anymore.

Hope that helps.

Point light is supported, so it would be great to have a look at your .fbx and/or blender file. If you aren't comftable posting it in the forum, please send it as email (or a link to the file) to info AT wikitude DOT com.

Regarding directional light, you can set an ambient light so the backside won't be black. Have you tried that?

Thanks, I'll email you a zip in a few minutes.  I appreciate the help.

 

One interesting thing I notice is that when I use a directional light source, the Wikitude 3D Encoder shows me the light's properties when I click on it in the hierarchy view.  It has direction and light color.

However, if I use a point light, I see no properties at all when I click on it in the hierarchy.

I've also tried using a directional light and increasing the ambient value (Blender's World button, Ambient Color setting) but it has no effect.

I've also looked at the FBX file, and in the material properties I see:

 

Property: "AmbientColor", "ColorRGB", "",0.5382,0.5382,0.5382

Property: "AmbientFactor", "double", "",1.0000

Property: "Ambient", "ColorRGB", "",0.5,0.5,0.5

 

And in AmbientRenderSettings I see:

 

AmbientLightColor: 0.5,0.5,0.5,0

 

... so that all seems reasonable.

 

If I can get some ambient light into the scene, I would be fine with a single directional light.  Alternatively, if i could have two or three directional lights, that would be fine too.

 

Thanks in advance for any help or suggestions.

Thanks for the model file. It helped to speed up things. So here's what I found out:

First the bad news: Blender does not export point lights correctly when using fbx. They end up without attenuation values (regardless of what is defined as falloff). This is nothing under our control and might change with a future exporter version.

However: The way point lights are exported is picked up as an ambient light source in our encoder. Therefore you can use a point light in blender to define ambient light. Additionally define a directional light and you should be able to get the desired effect.

A side note to DAE:

If exporting the scene as DAE you have to manually delete the attenuation paramters of the point light (which seem to be exported wrong as well) within the .dae file.

First of all, thanks for the suggestion about using a point light to produce ambient lighting.  I would never have thought of trying that.

I notice that the directional light doesn't appear to be pointing in the same direction in the encoder as it is in Blender.  If I have the directional light pointing straight down in Blender (illuminating the top half of my model), it appears to come from the right side in the encoder.  It's probably something to do with the coordinate system orientation being different (Blender has Z "up", whereas almost everyone else, including Wikitude, has Y "up").

At first I thought it might be a problem with Blender's FBX exporter (as it turned out to be for the point light issue), but when I look at the file in Autodesk's FBX viewer plugin for Quicktime it's correct.

 

 

 

I did see this happing and we will have a look at this next week. Have you tried it on the device? Is the light correctly rendered there?

FYI: One addition to the ambient light:

The odd thing is that exporting an ambient light from maya to fbx (where an ambient light is just another light type, like point, sun, spot ) will produce exactly this: a point light without attenuation. Still not intuitve but it explains why the encoder does handle a point light this way.

I'll try it on the device and let you know what the results are.  I would think they would be the same, since you're (probably) using the same OpenGL ES based renderer in both the encoder and the SDK.

Yes, very strange about the point light.  It sounds like the FBX exporter in Blender and one in Maya have the same issue with point lights.  That's surprising, since I believe the Blender FBX exporter is written in Python while the one in Maya is (I assume) written using Autodesk's FBX SDK.

 

 
Login or Signup to post a comment