GithubHelp home page GithubHelp logo

Comments (7)

Nbickford avatar Nbickford commented on August 25, 2024

from vk_raytracing_tutorial_khr.

Nbickford avatar Nbickford commented on August 25, 2024

from vk_raytracing_tutorial_khr.

MouseChannel avatar MouseChannel commented on August 25, 2024

maybe I did not make my question clear
p = 1/PI here represent the pdf of importance sampling pdf (which there is cos_weight_sampling)
line 111
https://github.com/nvpro-samples/vk_raytracing_tutorial_KHR/blob/8d4ba64b1816ef020bebe33298d496b305df2aca/ray_tracing_gltf/shaders/pathtrace.rchit#L111
show the out-going ray sampling strategy, and using cos_weight importance sampling
$$L_r =\int_{H^2} Li* BRDF *(indir \cdot normal) dw_i $$
$$L_r=\frac{ Li * BDRF * (indir \cdot normal)}{pdf} $$
here the pdf of cos_weight imporance sampling is $$p = pdf = \frac{cosTheta}{Pi}$$ just like you mentioned

and the algorithm in the code chooses outgoing directions
with pdf = cos theta/pi (where cos theta is the dot product in the equation
above).

and here you said

and
so always had cos(n, out) BRDF(in, out)/PDF(in, out) == 1.

$$\frac{cos(n, out) BRDF(in, out)} {PDF(in, out)} = \frac{cosTheta*1{/}Pi}{cosTheta/Pi} = 1$$

So if p represent pdf of cos_weight sampling here ,why should not be cosTheta/ Pi?
I worry about that latex may not be rendered if you read it from mail, and thanks to your reply.

from vk_raytracing_tutorial_khr.

MouseChannel avatar MouseChannel commented on August 25, 2024

and if p = 1/Pi as the pdf of sampling , in hemisphere the integral of p is not 1

from vk_raytracing_tutorial_khr.

Nbickford avatar Nbickford commented on August 25, 2024

Ah, I see! Sorry about that - thank you for following up! Since samplingHemisphere() is cosine-weighted, this line of code was incorrect -- it should have been const float p = cos_theta / M_PI. (As a result, you might notice that running the current code under the white furnace test renders a sphere that is too dark.) We'll put in a fix. Thanks!

from vk_raytracing_tutorial_khr.

MouseChannel avatar MouseChannel commented on August 25, 2024

:)

from vk_raytracing_tutorial_khr.

NBickford-NV avatar NBickford-NV commented on August 25, 2024

Fixed in #56 and 80e00ca; closing. Thanks again!

from vk_raytracing_tutorial_khr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.