ok I've thought an easy way, the ddx cross! ddy could be calculated in the vertex through a shift of a pixel(texcoord.xy) and a minus of the two plus a subsequent normalization, could be?
@xdxxdy For each vertex in a triangle, I passed x coord, y coord and height value of other two vertices into vertex shader. Therefore, when the vertex shader calculates normal for a vertex, it first calculates exact positions of all three vertices of the triangle, and then calculate the normal by crossing v0v1 and v0v2.
hi, I'm interested about the method you have uset to calculate the normals in the vertex shader(dx9? 10? 11?), I've tried tex2Dlod to manipulate the position.z but have no idea about the method used to obtain a normal, in the pixel shader could be made by ddx(dot)ddy. If you have a method to interpolate the calculated normals in the vertex shader please reply.
ok I've thought an easy way, the ddx cross! ddy could be calculated in the vertex through a shift of a pixel(texcoord.xy) and a minus of the two plus a subsequent normalization, could be?
xdxxdy 1 year ago
@xdxxdy For each vertex in a triangle, I passed x coord, y coord and height value of other two vertices into vertex shader. Therefore, when the vertex shader calculates normal for a vertex, it first calculates exact positions of all three vertices of the triangle, and then calculate the normal by crossing v0v1 and v0v2.
ChenZheChina 11 months ago
hi, I'm interested about the method you have uset to calculate the normals in the vertex shader(dx9? 10? 11?), I've tried tex2Dlod to manipulate the position.z but have no idea about the method used to obtain a normal, in the pixel shader could be made by ddx(dot)ddy. If you have a method to interpolate the calculated normals in the vertex shader please reply.
xdxxdy 1 year ago