Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


TheOrestes

Member Since 10 Feb 2009
Offline Last Active Jun 23 2015 08:10 AM

Posts I've Made

In Topic: Lighting Shader Confusion

18 January 2015 - 09:00 PM

Yup. Totally. Thanks :-)

In Topic: Lighting Shader Confusion

18 January 2015 - 12:31 PM

 

 

 

vs_outNormal = (matWorld * vec4(in_Normal, 1.0)).xyz;

This is the problem. You should put w = 0 and not 1.0. This ensure that you are not translating the normal like position. You also need to renormalize the normal after that. Also make sure you aren't using nonuniform scaling.

 

Another way is to move directional light to object space. This way you don't need any transformations at vertex shader and just one inverse transform per object.

 

 

Ahhh ... the W being 1  :( that was purely insane mistake from my end as its the vector i am transforming and not the point!

 

However, your second suggestion is exactly what i did to recify the mistake. Thanks a lot for assistance. :)


In Topic: Lighting Shader Confusion

18 January 2015 - 12:29 PM

Looks like bit of more perseverance from my end would have helped me. So, instead of me taking all the normals to world space, I applied World Inverse transformation on the light direction vector, which did the trick for me.

 

Here is the modified code :

vs_outNormal = normalize(in_Normal);
vs_outLightDir = normalize((matWorldInv * vec4(LightDirection,0.0)).xyz);

Here is the output :

 

World_Inv_Fixed.png

 

Thanks.

 

P.S :  Still in case you find anything wrong with the shader conceptually please let me know.


In Topic: Anyone here a self-taught graphics programmer?

25 July 2014 - 12:57 AM

Hi,

 

I am a self taught Graphics/Shader programmer. In India, we don't get luxury of having university courses dedicated to Games or Graphics. By the time you get good at math, you don't even know why you are doing Laplace's transfom & where it is used in pratice... Its just the fact that "How is this done?" made me take up graphics programming & C++ to learn new exciting stuff ...

 

My Story so far ...

 

1. Get overwhelmed by seeing what people have been doing, wondering how they did it

2. Study, take each topic at once, there is a huge mountain to climb & you always start at the base

3. Get more overwhelmed as each day passes by

4. Study more, implement stuff, keep learning

5. Even more overwhelmed

6. Tell it to yourself that one day you will reach there ....  (After all , this journey has been awesome knowing there is still so much to learn ! )

 

Cheers.


In Topic: D3DXMatrixLookAtLH vs Custom View Matrix

24 April 2014 - 09:57 AM

Thank you so much guys! smile.png

Appreciate all the help...

 

Cheers.


PARTNERS