Handle(Graphic3d_CLight) m_light = new V3d_SpotLight(gp_Pnt(0.0, 0.0, 5000.0), V3d_XposYneg, Quantity_NOC_WHITE);
m_AISLightSource = new AIS_LightSource(m_light);
doesn't matter what I do, the spotlight always points down (z-). Also when I change with setDirection(gp_Dir(...));
the m_AISLightSource shows the cone in the correct given direction, but the light doesn't move at all. Position m_light is changing ok.
I have no problem with V3d_DirectionalLight
Discussion
8 archived replies
Posts are displayed in their archived order.
01Commenter-1
Could you share some reproducible sample and screenshots? Which OCCT version you are using?
In Draw Harness spotlight could be defined via vlight command, and both vlight NAME -dir DX DY DZ and interactive vmanipulator work as expected for me:
pload MODELING VISUALIZATION
vclear
vinit View1
vlight -clear
vbackground -color GRAY
vrenderparams -shadingModel PHONG
vlight amblight -type AMBIENT -color WHITE -intensity 0.1
box b 0 0 0 30 30 30
vdisplay b -dispMode 1
vsetmaterial b Brass
vfit
vlight spot -type SPOTLIGHT -pos 15 -10 15 -dir 0 1 0 -color RED -display
vmanipulator m -attach spot -adjustPosition location
I've also tried samples/qt/OCCTOverview sample and changing spotlight direction in samples/OCCTOverview/code/Viewer3dSamples.cxxseems to be worked:
Shadow makes no sense. To me it looks like V3d_SpotLight is behaving like a V3d_PositionalLight
I see you are using Path Tracing in your screenshots. Indeed, Path-Tracing engine doesn't implement handling of Spot light sources - it treats them as positional sources (within OpenGl_View::updateRaytraceLightSources()). For that reason you'll not find such light sources in RayTracing, for example:
Archived image: external image
05Author
thank you
will this work in the near future?
and what is the point of having V3d_SpotLight if it doesn't work?
06Commenter-1
and what is the point of having V3d_SpotLight if it doesn't work?
The list of light source types V3d_AmbientLight, V3d_PositionalLight, V3d_DirectionalLight, V3d_SpotLight originates from light sources that could be defined within legacy OpenGL APIglLight(). And these types should still work within Phong and PBR shading models in OCCT viewer.
Path-Tracing engine has been added to OCCT Viewer later than light source API, and currently provides a mixture of properties, supported by legacy Phong (including non-physical properties like Graphic3d_CLight::LinearAttenuation()), by model PBR (like Graphic3d_CLight::Intensity()) and Path-Tracing engines (see Ray-Tracing / Path-Tracing light properties section within Graphic3d_CLight documentation).
I cannot say why Spot light source type hasn't been implemented within Path-Tracing engine - maybe developers haven't considered it useful enough, or postponed implementation for later and forgotten...
07Author
Thank you for taking the time to explain.
So there is still hope that this will come one day.
08Author
Found a workaround. Better then nothing:
Put a positional light into a cylinder and control the radius with adjusting the z of the light withing the cylinder. looks kind of ok.