Skip to content
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

BxDF tests #165

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open

BxDF tests #165

wants to merge 54 commits into from

Conversation

Przemog1
Copy link
Contributor

No description provided.

@devshgraphicsprogramming
Copy link
Member

devshgraphicsprogramming commented Jan 6, 2025

why do you have random things from sorakrit here instead of your own branch against his or master ?

I literally can't see whats yours and what's @keptsecret's.

Comment on lines 46 to 48
retval.T = nbl::hlsl::normalize<float32_t3>(rngFloat301(retval.rng));

retval.T = nbl::hlsl::normalize<float32_t3>(retval.T - nbl::hlsl::dot<float32_t3>(retval.T, retval.N) * retval.N); // gram schmidt

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can still generate T almost colinear to N and end up with numerical issues, personally I'd use the frisvad basis function + random rotation around N (only one random number needed)

Comment on lines 53 to 56
retval.eta = 1.3;// rngFloat01(retval.rng) + 1.0;
retval.ior = float32_t3x2(1.02, 1.0, // randomize at some point?
1.3, 2.0,
1.02, 1.0);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can only have one:

  • eta for BSDFs (things that refract) because refraction can only be done monochrome (each wavelength refracts at different angle)
  • ior for BRDFs (things that reflect) because reflection is alawys the same

Also eta is just a ratio of two refractive indices, and using matrix<float32_T,3,2> is very bad semantically because it assumes we'll have 3 spectral buckets.

Ideally we should do tests in monochrome, so just a float eta should be enough or vector<float,2> ior

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no dont keep it was a super bad idea, I also want to make everything templated so that vector<T,3> isn't implied for the colours and we could do other number of spectral buckets (1, 2 or 4 for spectral rendering)

SBxDFTestResources retval;

retval.rng = nbl::hlsl::Xoroshiro64Star::construct(seed);
retval.u = float32_t3(rngFloat01(retval.rng), rngFloat01(retval.rng), 0.0);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the third random number is sometimes necessary to discern discrete BxDF branches:

  • reflection vs refraction in e.g. glass
  • diffuse vs specular in e.g. plastic
  • choosing a leaf BxDF in a mixture/tree of BxDFs

Comment on lines 60 to 69
ray_dir_info_t dV(int axis)
{
float32_t3 d = (float32_t3)0.0;
d[axis] += h;
ray_dir_info_t retval;
retval.direction = V.direction + d;
return retval;
}

float h = 0.001;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. what do you need dV for?
  2. this is not the way to vary V parameter

Comment on lines 25 to 30
uint32_t pcg_hash(uint32_t v)
{
uint32_t state = v * 747796405u + 2891336453u;
uint32_t word = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u;
return (word >> 22u) ^ word;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is useful in its own header like xoroshiro is

@Przemog1 Przemog1 changed the title New tgmath BxDF tests Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants