gkv311 / occt-samples-qopenglwidget

Open CASCADE Technology sample - 3D Viewer within Qt Widgets window
Other
57 stars 16 forks source link

Light and shadows in viewer #14

Open yvanblanchard opened 1 year ago

yvanblanchard commented 1 year ago

Hello Is it possible to include soft or hard shadows in your occt viewer ? Or maybe indicate the few code lines to add? Thank you

gkv311 commented 1 year ago

You may activate real-time shadows from directional light sources. https://draw.sview.ru/visualization-shadows/

See Graphic3d_CLight::ToCastShadows() property of light source and Graphic3d_RenderingParams::ShadowMapResolution, ShadowMapBias properties to adjust rendering quality within V3d_View/V3d_Viewer.

Note that to see shadows you might want disabling headlight flag or adjusting its direction (otherwise shadows will be directed from the eye).

You may also play with Path Tracing (global illumination + Ray Tracing) options if you want creating a photorealistic screenshot.

gkv311 commented 1 year ago

Screenshot_20230601-092411