RenderKit / ospray

An Open, Scalable, Portable, Ray Tracing Based Rendering Engine for High-Fidelity Visualization
http://ospray.org
Apache License 2.0
1.02k stars 186 forks source link

Smooth shading issues #75

Closed fogleman closed 8 years ago

fogleman commented 8 years ago

We've noticed that spheres (and cylinders) aren't rendering correctly in ParaView + OSPRay. Digging into the issue, I noticed that they look alright if "vertex.normal" is not provided.

To factor ParaView out of the equation, I reproduced the issue with some edits to ospTutorial.cpp (see gist link). I put in mesh data for a sphere (sourced from OpenSCAD) including vertex normals. I added a single directional light. (Point lights exhibit the same issue.)

https://gist.github.com/fogleman/62167b02df359a187ca8e91ad65eef60

Below are renders with "vertex.normal" left out and with it provided. Note the pole in the first image and note the bottom in the second image.

Is this a bug?

without-normals

with-normals

jeffamstutz commented 8 years ago

Hi,

This definitely looks like a bug in OSPRay. We will look into it and get it fixed ASAP.

Thanks, Jeff

carsonbrownlee commented 8 years ago

This issue is actually from shadows. The model in question is too low polygon for hard shadows, you are simply seeing some faces being shadowed behind the polygon above them. You can fix this by turning off shadows or increasing the resolution of the sphere. We do not currently have a notion of occlusion intersections taking into account displaced surfaces.

johguenther commented 8 years ago

Just an additional note: I think the best solution would be to directly use OSPRay's sphere and cylinder geometries instead of triangle meshes. These will then be perfectly round (analog to infinitesimal fine tessellation) and thus that artifacts will be gone. Not sure however how difficult this is to implement in ParaView's OSPRay integration.

carsonbrownlee commented 8 years ago

good point johannes, and for most cases of creating sphere representations in VTK we support that (points), however this is not possible when VTK is sending polygonal geometry and unfortunately this will also pop up in any low polygon model we run into.