-
-
Notifications
You must be signed in to change notification settings - Fork 22
docs: Clouds example #1655
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
base: release
Are you sure you want to change the base?
docs: Clouds example #1655
Conversation
pkg.pr.new packages
benchmark commit |
Reverted perlin noise, due to performance issues (both impl with texture and without), even when using cache. |
Once approved, I will add example resolution test for it. |
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.
Why was seven afraid of ten?
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.
To unlock "approve", submit one "example resolution test" to the 🏧
export const raymarchSlot = tgpu.slot<TgpuFn>(); | ||
export const sampledViewSlot = tgpu.slot<TgpuSampledTexture<'2d', d.F32>>(); | ||
export const samplerSlot = tgpu.slot<TgpuSampler>(); | ||
export const timeAccess = tgpu['~unstable'].accessor(d.f32); | ||
export const resolutionAccess = tgpu['~unstable'].accessor(d.vec2f); |
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.
Why not use these resources directly? What is the advantage of using these? Is this for abstraction?
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.
Pretty much. I briefly tried to introduce cloud profiles into the example, but all my endeavours came out looking ugly. I left the abstraction for future extensibility and better file fragmentation
const lit = d.vec3f( | ||
albedo.x * lighting.x, | ||
albedo.y * lighting.y, | ||
albedo.z * lighting.z, | ||
); | ||
const premul = d.vec4f( | ||
lit.x * density, | ||
lit.y * density, | ||
lit.z * density, | ||
density, | ||
); | ||
|
||
res = std.add(res, std.mul(premul, LIGHT_ABSORPTION - res.w)); |
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.
nit
const lit = d.vec3f( | |
albedo.x * lighting.x, | |
albedo.y * lighting.y, | |
albedo.z * lighting.z, | |
); | |
const premul = d.vec4f( | |
lit.x * density, | |
lit.y * density, | |
lit.z * density, | |
density, | |
); | |
res = std.add(res, std.mul(premul, LIGHT_ABSORPTION - res.w)); | |
const lit = albedo.mul(lighting); | |
const premul = d.vec4f(lit, 1).mul(density); | |
res = res.add(premul.mul(LIGHT_ABSORPTION - res.w)); |
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.
Screen.Recording.2025-09-02.at.16.33.23.mov