# rampster

Member

6

100 Neutral

• Rank
Newbie
1. ## spot light bump mapping

Hi! I am trying to implement a spot light shader with bumpmapping and I am having problems getting the right output! I have the necessary spot light pixel shader inputs (vertex to light direction and spot direction) in view space and would like to convert them to tangent space. But I have only been able to find this version that converts world space to tangent space. // Create a transform to convert a world space vector to tangent space. mat3 tangentSpaceTransformMatrix = mat3(tangentVector, binormalVector, normalVector); my question here is : does the following matrix convert vertors from view space to tangent space? // Transform the normal, tangent and binormals to view space. mat3 inverseTransposeWorldViewMatrix = mat3(u_inverseTransposeWorldViewMatrix); vec3 tangentVector = inverseTransposeWorldViewMatrix * a_tangent; vec3 normalVector = inverseTransposeWorldViewMatrix * a_normal; vec3 binormalVector = inverseTransposeWorldViewMatrix * a_binormal; // Create a transform to convert a vector to tangent space. mat3 tangentSpaceTransformMatrix = mat3(tangentVector, binormalVector, normalVector); I am under an impression it does.. But please correct me if I am wrong! Thanks! mrp
2. ## spot light - collada

Hi, I have implemented a spot light shader with light range, inner cone angle, outer cone angle and spot direction as prime inputs. This shader is inspired from Wolfgang Engel's book programming vertex and fragment shader. My question is how do I get get my spot light shader inputs (light range, inner angle and outer angle) from a collada spot light node info (constant attenuation, linear attenuation, quadratic attenuation, fall off angle and fall off exponent) from the look of it outer cos angle = fall off angle but not very sure how to calculate the light range and inner cos angle. Is it even possible? Any help is much appreciated!! Thanks in advance, Ram
3. ## Point light shader question

Thanks for your Reply MJP .. that helped! I found some explanations here : http://developer.dow...el_Lighting.pdf that was great as well! I am going for the solution 1 because that meets all my needs for the application! Thanks again!
4. ## Point light shader question

Hey guys, I am trying to implement a simple point light shader in glsl and not sure which equation calculates the right attenuation from the below two links: 1. XNA shader programming tutorials says attenuation = 1 - dot (L/r , L/r). I like this one because of the point light radius parameter we could pass in. 2. Now Lighthouse3d tutorials (and most text books) says: attenuation = 1 / (KC + (kL * D) + (KQ * D * D)). Now which one do you guys think gives the right attenuation? If both are right what is the relation between them? Thanks in advance!

[color="#1C2837"] [color="#1C2837"]solved! [color="#1C2837"] "v_lightDirectionTangentSpace = u_directionalLight.direction * tangentSpaceTransform;" [color="#1C2837"] [color="#1C2837"]must have been [color="#1C2837"] [color="#1C2837"]v_lightDirectionTangentSpace = [color="#1C2837"]tangentSpaceTransform * [color="#1C2837"]u_directionalLight.direction; [color="#1C2837"] [color="#1C2837"]This was messing up the light direction and hence the lighting calculations!