Spotlight and materials

I’m working with an obj that has a metal floor and I want to achieve this kind of effect:





I tryed setting diffuse to 1,1,1 and applyed a a spotlight directed to the ground.



First I want to known if the mtl stores this kind of information (the diffuse) and then I want to know Why my spotlight didnt workout,

is like a pointlight right? but it has a direction. I use the same pointLight, but my scenes gets dark when using it.



thanks in advance.

The obj loader supports "Kd" tags in the mtl file, that should give your material the diffuse color.

But note that jME uses per vertex lighting - so you won't get that effect for a large quad floor, you'd have to subdivide it into multiple small faces.

what do you mean by faces? do I have to subdivide my obj? or just the texture on it?

mako said:

what do you mean by faces? do I have to subdivide my obj? or just the texture on it?

Subdivide the geometry, in whatever 3d editor you are using, before exporting to obj.

EDIT: see http://www.jmonkeyengine.com/jmeforum/index.php?topic=6288.msg50407#msg50407 for more explanation

well, so, If I dont want to subdivide my obj I'll have to write a shader. do you known a good tutorial?

See jmetest.effects.glsl.* for examples of loading GLSL shaders in jME, it's really easy. or you could use my code from http://www.jmonkeyengine.com/jmeforum/index.php?topic=6322 as a starting point - it's for directional lighting, and not working properly, but you should not have any problems to adjust it to your needs. Maybe you can even point me to what's wrong with my GLSL code!

As for the GLSL coding, I'd recommend OpenGL @ Lighthouse 3D - A Resource for Programmers for reading.

Note that you can also use ARB programs, you'll find examples in package jmetest.renderer.state.

You can also use a lightmap texture instead if you don't need the spotlight to light up anything but this ground.

yeah, but the texture is tiny, and it repeats all over the floor.

In that case you use multitexture/multipass to blend in a lightmap, you do not use scaled coord/matrix for the 2nd texture unit so it doesn't repeat.

I'm using an obj exported with its mtl



how can I do this multipass thing?