Raffaello / threedangles

3D triangles software rendering engine from scratch
MIT License
0 stars 0 forks source link

clipping is breaking continuity on the Vertex colors interpolation and vertex normal. #13

Closed Raffaello closed 2 years ago

Raffaello commented 2 years ago

with gouraud shading is possible to see that the vertex normal probably are not copied over.

Raffaello commented 2 years ago

Clipping function, intersect method.

Clipping.cpp Lines:

when creating a new triangle the new vertex(es) doesn't have the color property and neither the normal, those 2 need to be recomputed:

so probably the best thing is to clipping during the raster phase for screen coordinates at least, so the interpolation will be the same but "cutted off" when reach the screen border.

Raffaello commented 2 years ago

perspective correction is not working ok.....

Raffaello commented 2 years ago

the w parameter when clipping is lost ....

Raffaello commented 2 years ago

fixed with interpolation, but i don't think is the right way.. better review the clipping and do it including the w parameter too.

Raffaello commented 2 years ago

follow-up https://github.com/Raffaello/threedangles/issues/17