Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Okay, I am using Ogre3D and Gorilla(2D library for ogre3D) and I am making Gorilla::Screenrenderables in the open scene.

The problem that I am having is that when I make a light and have my SR(screenrenderable) near it, it does not light up unless the face of the SR is facing the light...

I am wondering if there is a way to maybe set the material or code(which would be harder) so the SR is lit up whether the vertices of the polygon are facing the light or not. I feel it is possible but the main obstacle is how I would go about doing this.

share|improve this question
    
Your description implicates that you just want the GUI to be always drawn as it were lit e.g. to be excluded from the lighting. "lighting off" in the material should do the trick. Probably. –  API-Beast Jun 3 '12 at 22:30
    
actually no, the screenrenderable is the sprite that is rendered in the 3D space. in this 3d space, I want these SRs to be lit up regardless of facing towards the light. the GUI is something completely different. yes the sprites are shown all the time, but are only lighted by non-ambient lights in said way –  Molmasepic Jun 3 '12 at 22:34
    
If you want them to be lit properly they need to be proper 3D models. Lighting always depends on direction. Well, you probably could shade it depending on the distance to the lights in the shaders instead, completly ignoring the direction. –  API-Beast Jun 3 '12 at 22:41
    
that sounds good. Any idea where I could get a good start on that? –  Molmasepic Jun 3 '12 at 22:48
    
Hey I have an idea, what if I lit up my SR by distance(regardless of facing)? –  Molmasepic Jun 4 '12 at 23:52
show 2 more comments

1 Answer 1

In a typical shaders, no mater if it's a vertex or fragment one, you have somewhere a dot product between light direction and surface normal. Then you have a check if the result is less than 0, which means your surface has light at its 'back'.

Now, if you compute abs( dotproduct ) instead of just dotproduct you should get lighting on both sides of your geometry.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.