Jump to content

View more

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Tessellation makes point

4: Adsense

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
3 replies to this topic

#1 urza57   Members   

116
Like
0Likes
Like

Posted 19 June 2012 - 05:16 AM

A little problem with my tessellation shader. I try to implement a simple tessellation shader but it only makes points.
Here's my vertex shader :

[source lang="cpp"]out vec4 ecPosition;out vec3 ecNormal; void main( void ){ vec4 position = gl_Vertex; gl_Position = gl_ModelViewProjectionMatrix * position; ecPosition = gl_ModelViewMatrix * position; ecNormal = normalize(gl_NormalMatrix * gl_Normal);}[/source]


My tessellation control shader :

[source lang="cpp"]layout(vertices = 3) out;out vec4 ecPosition3[];in vec3 ecNormal[];in vec4 ecPosition[];out vec3 myNormal[];void main(){ gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; myNormal[gl_InvocationID] = ecNormal[gl_InvocationID]; ecPosition3[gl_InvocationID] = ecPosition[gl_InvocationID]; gl_TessLevelOuter[0] = float(4.0); gl_TessLevelOuter[1] = float(4.0); gl_TessLevelOuter[2] = float(4.0); gl_TessLevelInner[0] = float(4.0);}[/source]


And my Tessellation Evaluation shader:

[source lang="cpp"]layout(triangles, equal_spacing, ccw) in;in vec3 myNormal[];in vec4 ecPosition3[];out vec3 ecNormal;out vec4 ecPosition;void main(){ float u = gl_TessCoord.x; float v = gl_TessCoord.y; float w = gl_TessCoord.z; vec3 position = vec4(gl_in[0].gl_Position.xyz * u + gl_in[1].gl_Position.xyz * v + gl_in[2].gl_Position.xyz * w ); vec3 position2 = vec4(ecPosition3[0].xyz * u + ecPosition3[1].xyz * v + ecPosition3[2].xyz * w ); vec3 normal = myNormal[0] * u + myNormal[1] * v + myNormal[2] * w ); ecNormal = normal; gl_Position = vec4(position, 1.0); ecPosition = vec4(position2, 1.0); }[/source]


Here's a screenshot : http://img4.imagesha...nstitrektht.png
Thanks all!

#2 Ashaman73   Members   

13714
Like
0Likes
Like

Posted 19 June 2012 - 06:45 AM

For me your image is almost pitch black...

Ashaman

 

Gnoblins: Website - Facebook - Twitter - Youtube - Steam Greenlit - IndieDB - Gamedev Log


#3 Theodoros   Members   

571
Like
2Likes
Like

Posted 19 June 2012 - 08:52 AM

Do you set the primitives to GL_PATCHES and set the glPatchParameteri ?

#4 urza57   Members   

116
Like
0Likes
Like

Posted 20 June 2012 - 01:21 AM

Yes I have set all the parameters.




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.