1
\$\begingroup\$

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.

\$\endgroup\$
7
  • \$\begingroup\$ 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. \$\endgroup\$
    – API-Beast
    Commented Jun 3, 2012 at 22:30
  • \$\begingroup\$ 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 \$\endgroup\$
    – Molmasepic
    Commented Jun 3, 2012 at 22:34
  • \$\begingroup\$ 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. \$\endgroup\$
    – API-Beast
    Commented Jun 3, 2012 at 22:41
  • \$\begingroup\$ that sounds good. Any idea where I could get a good start on that? \$\endgroup\$
    – Molmasepic
    Commented Jun 3, 2012 at 22:48
  • \$\begingroup\$ Hey I have an idea, what if I lit up my SR by distance(regardless of facing)? \$\endgroup\$
    – Molmasepic
    Commented Jun 4, 2012 at 23:52

1 Answer 1

1
\$\begingroup\$

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.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .