-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Volumetric spotlight #15046
base: master
Are you sure you want to change the base?
Volumetric spotlight #15046
Conversation
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://babylonsnapshots.z22.web.core.windows.net/refs/pull/15046/merge/index.html#WGZLGJ#4600 Links to test babylon tools with this snapshot: https://playground.babylonjs.com/?snapshot=refs/pull/15046/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/15046/merge#BCU1XR#0 |
WebGL2 visualization test reporter: |
Visualization tests for WebGPU (Experimental) |
Yeah this should also fix the issue with the cone lookAt direction Test PG: localhost:1338/#KIXHUK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to decouple SpotLight
from VolumetricSpotLight
as much as possible (better for class independence and tree shaking).
I don't think it's necessary to modify the SpotLight
class. The user can simply do new VolumetricSpotLight(...)
to create a volumetric spotlight. This would also get rid of the IVolumetricSpotLight
interface.
I'd also like to change the class name, because if we implement a true volumetric light in the future, we'll probably want to use VolumetricSpotLight
for the name... I'm not sure which name to use (SimpleVolumetricSpotLight
? FakeVolumetricSpotLight
?). Let's summon @bghgary, the master of names!
Finally, you need to add documentation to the class/methods to keep the CI happy :)
} | ||
|
||
private _update(){ | ||
const lightPos = this.spotLight.position.clone(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this function is called each frame, you should remove all the GC and not create new objects.
Use TmpVectors.Vector3[0]
, TmpVectors.Vector3[1]
, etc to hold temporary results.
new test PG: http://localhost:1338/#KIXHUK#3 also implemented soft intersection using depthRender |
Visualization tests for WebGPU (Experimental) |
import { ShaderMaterial } from "core/Materials/shaderMaterial"; | ||
import "../Shaders/simpleVolumetricSpot.fragment"; | ||
import "../Shaders/simpleVolumetricSpot.vertex"; | ||
import { Observer, RenderTargetTexture, TmpVectors } from ".."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is not allowed to import from a folder, import every element from their respective files.
Marked as draft until the PR is ready. Would be great to have the format/lint/doc and at least one visual test. Also it would be great to ensure it follows the various falloff types inverse squared vs linear and so on ? |
Let me close for now and I ll let you reopen when ready ? |
This PR implements volumetric spotlight
Test: http://localhost:1338/#0BUGL8