Hello Ventuzians!
THE FORUMS ARE CLOSED!

Please join our discord server HERE!! << click me :D

We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server

Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!

HLSL Matrix

All other topics about Ventuz here.

Moderator: Support

Post Reply
joschy
Posts: 142
Joined: 19 Jan 2012, 07:39
Location: Düsseldorf, Germany
Contact:

HLSL Matrix

Post by joschy » 27 Jun 2013, 10:59

Hello,
i try to rebuild a simple shader example from AMD's RenderMonkey. I need therefor two matrixes, WORLDVIEWPROJECTION & VIEW, but it seems that only one matrix at the time is possible. See the attached pic... Or do i something wrong?

joschy
Attachments
HLSL_Matrix.png
3DJo - [Ventuz] freelancer and trainer

joschy
Posts: 142
Joined: 19 Jan 2012, 07:39
Location: Düsseldorf, Germany
Contact:

Re: HLSL Matrix

Post by joschy » 27 Jun 2013, 11:15

ok, i got it, but...

[// Vertex shader program output
struct VS_OUTPUT
{
float4 Pos: POSITION;
float2 texCoord: TEXCOORD0;
float color: TEXCOORD1;
};


// Vertex Shader Program

VS_OUTPUT VS(float4 Pos: POSITION )
{
VS_OUTPUT Output;

float3 pos;

// Billboard the quads.
// The view matrix gives us our right and up vectors.
pos = 5 * Pos.z * (Pos.x * View_matrix[0]+ Pos.y * View_matrix[1]);

// Transform the vertex from 3D object space to 2D screen space.
Output.Pos = mul(float4(pos, 1), WorldViewProjection);
//Output.Pos = mul(Pos, WorldViewProjection);
Output.texCoord = Pos.xy;
Output.color = Pos.z;
return Output;

}
]

The poly should face to the view, but it doesn't. Any suggestions why? Pic from the RenderMonky screen attached.

joschy
Attachments
RenderMonkey.PNG
3DJo - [Ventuz] freelancer and trainer

joschy
Posts: 142
Joined: 19 Jan 2012, 07:39
Location: Düsseldorf, Germany
Contact:

Re: HLSL Matrix

Post by joschy » 27 Jun 2013, 11:54

mmmhh, it seems that these line is different calculated:
[pos = 15 * Pos.z * (Pos.x * view_matrix[0] + Pos.y * view_matrix[1]);]
Attachments
RenderMonkeyDisassembly.PNG
RenderMonkey Disassembly
VentuzDisassembly.PNG
Ventuz Disassembly
3DJo - [Ventuz] freelancer and trainer

joschy
Posts: 142
Joined: 19 Jan 2012, 07:39
Location: Düsseldorf, Germany
Contact:

Re: HLSL Matrix

Post by joschy » 27 Jun 2013, 12:25

I´ve reduced all the VS stuff and compare it again. RenderMonkey uses Dotproduct operations where Ventuz uses mul & mad operations, interesting..
Attachments
RenderMonkeyDisassembly02.PNG
RenderMonkey
VentuzDisassembly02.PNG
Ventuz
3DJo - [Ventuz] freelancer and trainer

joschy
Posts: 142
Joined: 19 Jan 2012, 07:39
Location: Düsseldorf, Germany
Contact:

Re: HLSL Matrix

Post by joschy » 27 Jun 2013, 13:57

it works, have to have the right orientation of the mesh ;)

cheers, joschy
3DJo - [Ventuz] freelancer and trainer

Post Reply