Jump to content

  • Log In with Google      Sign In   
  • Create Account


HLSL Billboard not working


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 KurtO   Members   -  Reputation: 224

Like
0Likes
Like

Posted 29 October 2012 - 11:27 AM

I can´t seem to get my billboard HLSL code to work in my vertex shader.
My result is that my Quad is not showing at all...

My code for Billboarding is:

I don´t understand why it is all blank?
[source lang="cpp"]float4x4 matWorldView = mul(worldMatrix, viewMatrix); float3 vPositionVS = position + float3(matWorldView._41, matWorldView._42, matWorldView._43); output.position = mul(float4(vPositionVS, 1.0f), projMatrix);[/source]

and my complete vertex shader looks like this :

OBS! My worldMatrix is Identity if that mathers.

[source lang="cpp"]VOut VShader(float4 position : POSITION, float4 normal : NORMAL, float2 texcoord : TEXCOORD, float4 color: COLOR){ VOut output; //This is the billboard code. float4x4 matWorldView = mul(worldMatrix, viewMatrix); float3 vPositionVS = position + float3(matWorldView._41, matWorldView._42, matWorldView._43); output.position = mul(float4(vPositionVS, 1.0f), projMatrix); //I just commented this code out for the billboard code //output.position = mul(final, position); //The rest is just lighting. // set the ambient light output.color = ambientcol; output.color.rgb = color.rgb; // calculate the diffuse light and add it to the ambient light float4 norm = normalize(normal); float diffusebrightness = saturate(dot(norm, lightvec)); output.color += lightcol * diffusebrightness; //be sure to take alpha last as other formulas might destroy this. output.color.a = color.a; output.texcoord = texcoord; // set the texture coordinates, unmodified return output;}[/source]

Edited by KurtO, 29 October 2012 - 11:29 AM.


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS