RenderKit / ospray

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

SunSky help #514

Closed GerryArk closed 2 years ago

GerryArk commented 2 years ago

I am a beginner with OSPray so putting all at work requires more than reading the docs

Here is my SunSky

    GetSunPosition(st.DateTime, st.latitude, st.longitude, st.north_offset, azimut, elev_angle, SunPlane);

    ospray::cpp::Light light = ospray::cpp::Light("sunSky");
    light.setParam("direction",  Vector(SunPlane.zaxis)  );
    light.setParam("up",  Vector(SunPlane.yaxis)  );
    light.setParam("turbidity",  st.turbidity );
    light.setParam("albedo", st.albedo );

    light.setParam("color", Color(ON_Color(200, 200, 200))); //testing this 

    light.setParam("intensityQuantity", OSP_INTENSITY_QUANTITY_SCALE);
    light.setParam("intensity", 0.025f / st.turbidity);
    light.commit();
    OSPRayError = LastErrorMessage();
    mlight_vector.push_back(light);

No error, but in the rendering I do not see the sun light , nor shadows, so something is wrong Any hint on how to detect the issue ?

johguenther commented 2 years ago

Some things to check:

BruceCherniak commented 2 years ago

Another quick check you might try. OSPRay will set default values for all parameters. If you comment out your parameters and simply create the sunSky light, do you see anything then?

GerryArk commented 2 years ago

Thanks guys, Yes I have found one problem, the sun position, now the sun light and shadows are Ok, I do not see the sky background, anything to know about this ?

BruceCherniak commented 2 years ago

You might check the horizonExtension. Anything below the horizon is not part of the sky background. But, you can stretch the sky dome with this value. Or, make sure that you are looking above the horizon.

johguenther commented 2 years ago

Lights need to be visible, but this is the default. Which renderer do you use? SciVis needs to additionally have visibleLights on (which is off by default), the Path Tracer will show it always (if the light is visible). Also, if you have a bright / white backgroundColor set in the renderer then the sky will be "hidden".

GerryArk commented 2 years ago

I am using the pathtracer , the background is always white in the rendering. I have set backColor to (0,0,0) One thing to underline is that my environment has Z upvector , X-Y plane of Horizon, how does the software get this info ?

GerryArk commented 2 years ago

Ok, sorry I have found again that the up vector was still wrong. Now it works fine. thanks for your effort.