mlivesu / cinolib

A generic programming header only C++ library for processing polygonal and polyhedral meshes
MIT License
934 stars 101 forks source link

OpenGL rendering: soft shadows #153

Closed yvanblanchard closed 2 years ago

yvanblanchard commented 2 years ago

Hello,

Do you think it would be possible to add soft shadows effects to the rendering system of Cinolib viewer ? Or do we have to send request to glfw ?

thank you.

mlivesu commented 2 years ago

Hi. This is indeed possible, but in all honesty it hardly fits my todo list. The best thing you can do so far without adding a single line of code is to make sure that your scene contains a "floor" mesh, and then use the ambient occlusion to simulate some fake shadows beneath the objects lying on that floor. Keep in mind that this is not quite the same thing, because AO assumes that light comes from all directions, whereas real shadows are cast a directional light

yvanblanchard commented 2 years ago

Thank you very much for your quick reply. I will test that and let you know.

other quick question: I have an application that uses libQglViewer (open source lib) ; do you think it would be possible to use cinolib with it without any risk of interferences with OpenGL ? Thank you again.

mlivesu commented 2 years ago

the very first GLcanvas of cinolib was actually based on libQGLViewer, which was then substituted by a plain Qt 3D canvas and eventually by GLFW. Assuming you do not use both libQGLViewer and the new GLcanvas, the rest of the library should be fine with it. Technically, you could also use both, but in this case it may become tricky to handle multiple GL contexts that all live in your application...