glob3mobile / g3m

The multiplatform advanced visualization framework
http://www.glob3mobile.com/
Other
117 stars 56 forks source link

SceneLightining does not affect scene [iOS] #93

Open tomasstranik opened 9 years ago

tomasstranik commented 9 years ago

Hi,

I want to create some kind of sun illumination effect on the globe.

I have found SceneLighting class which should affect the scene. I have opened demo G3MApp and changed color in class CameraFocusSceneLighting into red (SceneLighting.cpp:87):

    glState->addGLFeature(new DirectionLightGLFeature(lightDir.asVector3D(),
                                                      Color::red(),
                                                      Color::red()),
                          false);

but the scene is always same. The change of the color has no effect.

I'm using iOS version of the library.

Could you please help?

DiegoGomezDeck commented 9 years ago

Hello @tomasstranik

If by "scene" you mean "terrain", the problem there is we're not generating normals for terrain tiles. As soon as any mesh has normals, the light effect will be present.

You can see a (non full working) normals generation for terrain tiles at PlanetTileTessellator::createTileMesh

Just uncomment this line:

// IFloatBuffer* normals = NormalsUtils::createTriangleStripSmoothNormals(verticesB, indicesB);

Let me know if this help.

tomasstranik commented 9 years ago

Thank you for your quick reply.

Be "scene" I mean the globe painted on the sphere as you can see when you run the demo G3MApp when you set WMSLayer - Nasa Blue Marble.

Is there any code which generates normals for the sphere?

DiegoGomezDeck commented 9 years ago

Is there any code which generates normals for the sphere?

yes, the code I pointed you before does something in this direction but it doesn't work well on the edges of the tiles.

tomasstranik commented 9 years ago

Yes, you are right. The normals are not generated correctly.

Thank you for pointing me to the right direction.

Is there any plan when this will be fixed?

DiegoGomezDeck commented 9 years ago

@tomasstranik we have no plan to add normals to the terrain-meshes soon as it's not in our high-priority just now.

BTW, if you really need it please contact me ( diego(at)glob3mobile(dot)com ) to look for options to make it works.