Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  questions about rendering ellipsoids
#1
Hi !


I was trying to write my own shader for fluid rendering these days. I've read the  codes for ellipsoid rendering in ObiEllipsoids.cginc and I've come across some questions about the visible ellipsoid radius in "VisibleEllipsoidCircleRadius" and "IntersectEllipsoid". Why is the radius equals to sqrt(1-t) ? And according to the fragment shader in FluidThickness.shader,  the mapping.w is  the visible ellipsoid radius,  but when doing the intersection detection in function "IntersectEllipsoid" on line "float iq = 1 - r2/mapping.w", why do we use mapping.w instead of square of mapping.w ? Perhaps I've misunderstood  about  the ellipsoid radius, is there any reference or article about this part for further reading?

Thanks!
Reply
#2
(25-11-2021, 04:10 AM)ccmiao Wrote: Hi !


I was trying to write my own shader for fluid rendering these days. I've read the  codes for ellipsoid rendering in ObiEllipsoids.cginc and I've come across some questions about the visible ellipsoid radius in "VisibleEllipsoidCircleRadius" and "IntersectEllipsoid". Why is the radius equals to sqrt(1-t) ? And according to the fragment shader in FluidThickness.shader,  the mapping.w is  the visible ellipsoid radius,  but when doing the intersection detection in function "IntersectEllipsoid" on line "float iq = 1 - r2/mapping.w", why do we use mapping.w instead of square of mapping.w ? Perhaps I've misunderstood  about  the ellipsoid radius, is there any reference or article about this part for further reading?

Thanks!

Hi there!

Obi implements this article:
https://tu-dresden.de/ing/informatik/smt...df?lang=de

There the math is laid out in a very detailed way. Let me know if I can be of further help!
Reply
#3
Thanks ! It really helps a lot !

Hi !
I've read the paper and found the equation of the intersection in section 4.1 very confusing.

As $\widetilde{q}$ is defined to be $\widetilde{q} = \frac{1}{\widetilde{r}}\left\{\begin{matrix}\widetilde{x} \\ \widetilde{y}\end{matrix}\right\}$ ,
so I think the square of $\widetilde{q}$ should be $\widetilde{q}^2=\frac{1}{\widetilde{r}^2}(\widetilde{x}^2+\widetilde{y}^2)$,
not $\widetilde{q}^2=\frac{1}{\widetilde{r}}(\widetilde{x}^2+\widetilde{y}^2)$.

Then maybe the code in function IntersectEllipsoid in file ObiEllipsoids.cginc for calclulating iq
float iq = 1 - r2/mapping.w;

should be
float iq = 1 - r2/(mapping.w * mapping.w);


I'm not sure if I'm right, please let me know if I've misunderstood about this part.
Reply
#4
I  got confused on this part too. And I also think it should be the square of \widetilde{r}. So which one is correct? Please let me know of the progress.
Reply
#5
(09-12-2021, 07:22 AM)littleaa Wrote: I  got confused on this part too. And I also think it should be the square of \widetilde{r}. So which one is correct? Please let me know of the progress.

Quoting the paper:

Quote:By dividing the coordinates by r, the in this way normalized x- and y- coordinates need to be inside the easier to handle unit circle.

That's why r2 is divided by mapping.w (which is the radius, r). This equation:

Quote:square(q) = 1/r * (x*x + y*y);

in code:

Code:
float r2 = dot(mapping.xy, mapping.xy);
float iq = 1 - r2/mapping.w;

r2 is the sum of the squares of x and y. then, we multiply it by 1/r: r2/mapping.w

So iq = 1- square(q)., used in the denominator of equation (11) - the one that calculates lambda. In the IntersectEllipsoid function you can see it being used:

Code:
float lambda = 1/(1 + mapping.z * sqrt(iq));

Hope this clarifies it. let me know if you need further help!

cheers,
Reply
#6
What confused me is that as q = 1/r(x,y), so  why square(q) = 1/* (x*x + y*y); isn't that should be square(q) = 1/(r*r)* (x*x + y*y); ?
Reply
#7
(10-12-2021, 10:40 AM)ccmiao Wrote: What confused me is that as q = 1/r(x,y), so  why square(q) = 1/* (x*x + y*y); isn't that should be square(q) = 1/(r*r)* (x*x + y*y); ?

It's just notation. square(q) !=  q2. q is a 2-component vector, and q2 is a scalar value, so they don't even have the same dimensionality.

q2 is used to simplify the original intersection equation into equation (10).
Reply