I have a Box and if I don't scale it the spot light looks really good on that box, but after I scale this Box to be a floor or I make the new instance of the box with a big size, the spot light doesn't work on the Box (I mean you don't see the spot light anywhere!). I had this same problem when I was playing with the OGRE engine and I solved it by just normalizing the normals of the Box. So how do I normalize the normals of a Box after it is scaled? Or how can I make a spot light works on a Box really big? By big I mean this:
Box floor=new Box("Floor", Vector3f.ZERO, 1,0.25f,1);//Or Box floor=new Box("Floor", Vector3f.ZERO, 15,0.25f,15) without scaling it
floor.setLocalTranslation(0, -8, 0);
Thank you. I hope your answer
try to make many small boxes instead of one big.
Ok, I'm sure that method will solve my problem but what if I load a big 3ds model that I made in 3d max studio for example? Using your method will mean that the floor has to be modelled in 3d max as a set of little boxes? I don't think that would be a practical method for an artist!!
i'm bad at explaining this because i am not experienced in this area, but i try anyway
the problem is, that when you have one big quad, you have only very few vertices.
the spotlight or light generally is using the vertices to decide where to light up the surface.
So basically its no possible to have a spotlight that only lights up a small part of a single big quad.
What you can do is.
- use a pixel shader
- use a projected texture instead a 'real' spotlight as a spotlight
- other things i don't know about
Ok Thank you very much!!. Your explanation was very clear. I will try the things you said. First I'm gonna try putting more vertices in a simple box from 3d max, blender or any other modelling tool.
hey, i had the same problem. i'd explain it like this:
number of vertices = resolution of lighting, similar to number of pixels = resolution if image.
Thank you very much for your explanations. I made a box (the floor) in 3d max 2008 with a lot more vertices and I exported it to 3DS. Then I loaded it with jmonkey and now the good news is that the spot light works on that floor but the bad news are these ones:
- I put the spot light in (0, 10, 0) with direction in (0, -1, 0) and the spot light only shows HALF of the circle! I mean on the floor you can only see a half of the circle of a spotlight when it should be the whole circle. The floor's position is (0, -8,0) and the angle of the spot light is 15.
- I set the spot light to be a shadow caster (spotLight.setShadowCaster(true)) and I have a Box (a normal jmonkeyengine Box) in position (0,0,0) that succesfully emits its shadow on that floor if I put a directional or a point light. But with the spot light it won't show its shadow.
I apologize for asking a lot of things about this light problem but I really want to learn! The code for the new instance of the spot light is:
SpotLight sp1 = new SpotLight();
sp1.setDiffuse(new ColorRGBA(1.0f, 1.0f, 1.0f, 5.0f));
sp1.setAmbient(new ColorRGBA(0.5f, 0.5f, 0.5f, 4.0f));
sp1.setDirection(new Vector3f(0, -1, 0));
sp1.setLocation(new Vector3f(0, 10, 0));
That is the ONLY light attached to ls. I hope your answer. Thank you.