Skip to main content
gamedev.net
🔒 Locked

cg problem

Started by hello_there Jun 8, 2004 at 4:34 AM 3 replies 750+ views
Original Post
hello_there
hello_there
T have this cg program and i can''t figure out way it doesn''t work i know it somthing to do with the last bit but i can''t figure out what can someone please help me. float3 expand(float3 v) { return (v-0.5)*2; } void C8E2f_bumpSurf(float2 normalMapTexCoord : TEXCOORD0, float3 lightDirection : TEXCOORD1, float3 halfAngle : TEXCOORD2, out float4 color : COLOR, uniform float ambient, uniform float4 LMd, // Light-material diffuse uniform float4 LMs, // Light-material specular uniform sampler2D normalMap, uniform sampler2D decal, uniform samplerCUBE normalizeCube, uniform samplerCUBE normalizeCube2) { // Fetch and expand range-compressed normal float3 normalTex = tex2D(normalMap, normalMapTexCoord).xyz; float3 normal = expand(normalTex); // Fetch and expand normalized light vector float3 normLightDirTex = texCUBE(normalizeCube, lightDirection).xyz; float3 normLightDir = expand(normLightDirTex); // Fetch and expand normalized half-angle vector float3 normHalfAngleTex = texCUBE(normalizeCube2, halfAngle).xyz; float3 normHalfAngle = expand(normHalfAngleTex); // Compute diffuse and specular lighting dot products float diffuse = saturate(dot(normal, normLightDir)); float specular = saturate(dot(normal, normHalfAngle)); // Successive multiplies to raise specular to 8th power float specular2 = specular*specular; float specular4 = specular2*specular2; float specular8 = specular4*specular4; float4 decalColour = tex2D(decal, normalMapTexCoord); color = decalColour*(ambient+diffuse) + LMs*specular8; } the decalColour works i tried it out by just puting that as the colour. it''s realy weird since it works if you replace decalColour with LMd.
____________How could hell be worse?
hello_there
hello_there
i''m using the fp20 profile and it works using the same texture coordinates. change the last bit to this works. I''l give what you said a try any way.

float4 decalColour = tex2D(decal, normalMapTexCoord);

color = decalColour;
____________How could hell be worse?
hello_there
hello_there
hmm thanks that worked i though you where only allowed to do 1 texture lookup per fragment program. i never though there was a limit on using texture coordinates.
____________How could hell be worse?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.