
Fri, 03/28/2025 - 03:17
Forums:
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
Fri, 03/28/2025 - 09:07
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 bothvlight NAME -dir DX DY DZ
and interactivevmanipulator
work as expected for me:I've also tried
samples/qt/OCCTOverview
sample and changing spotlight direction insamples/OCCTOverview/code/Viewer3dSamples.cxx
seems to be worked:Fri, 03/28/2025 - 18:34
In your example I only see the cone but not the light and shadow. This is working here as well.
Spot1.png = setPosition(0,0,3000) setDirection(gp_Dir(1,0,-1)
Spot2.png = setPosition(0,0,3000) setDirection(gp_Dir(1,0,0)
Spot3.png = setPosition(1000,0,3000) setDirection(gp_Dir(1,0,0)
Shadow makes no sense. To me it looks like V3d_SpotLight is behaving like a V3d_PositionalLight
Whatever (in range) values I put in, nothing changes.
Other problem:
Thanks!
PS: using 7.9.0
Fri, 03/28/2025 - 20:37
please see spot4.png. this is what your sample code is doing.
Fri, 03/28/2025 - 21:47
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:
Fri, 03/28/2025 - 22:57
thank you
will this work in the near future?
and what is the point of having V3d_SpotLight if it doesn't work?
Fri, 03/28/2025 - 23:56
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 (likeGraphic3d_CLight::Intensity()
) and Path-Tracing engines (seeRay-Tracing / Path-Tracing light properties
section withinGraphic3d_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...
Sat, 03/29/2025 - 17:26
Thank you for taking the time to explain.
So there is still hope that this will come one day.
Fri, 03/28/2025 - 23:27
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.