• No results found

Real Time Visualization of Algebraic Surfaces

N/A
N/A
Protected

Academic year: 2022

Share "Real Time Visualization of Algebraic Surfaces"

Copied!
38
0
0

Laster.... (Se fulltekst nå)

Fulltekst

(1)

Real time Ray-Casting of Algebraic Surfaces

Martin Reimers Johan Seland

Center of Mathematics for Applications University of Oslo

Workshop on Computational Method for Algebraic Spline Surfaces Thursday 13. September

(2)

Introduction

Raycasting

An algebraic surface is the zero set of a polynomial f(x,y,z) = X

0≤i+j+k≤d

fijkxiyjzk = 0.

Raycasting amounts to “shooting” rays inside a view frustum (VF) and determine if they intersect the surface.

I Can miss thin features

I Conceptually “easy”

I Embarrassingly parallel

(3)

Introduction

For a ray rpq(t) raycasting amounts to finding the smallestt ∈[0,1] s. t.

f((1−t)npq+tfpq) =f(rpq(t)) = 0.

We would like to work on a univariate polynomial in Bernstein form, f(rpq(t)) =

d

X

k=0

cpqkBkd(t)= 0.

I Assume a screen resolution of (m+ 1)×(n+ 1) pixels.

I Pixel (p,q) corresponds to a ray throughp and the pixel with coordinates (p/m,q/n).

p rpq(t)

farplane

nea rplane

(4)

Introduction

Overview

Our algorithm thus consist of the following steps:

1. Compute ray coefficientsC = (cpqk)

2. For each pixel (p,q)

2.1 Seek the smallest root t[0,1] of f(rpq(t)).

2.2 Compute a color for pixel (p,q). 3. Optionally, perform postprocessing

3.1 Detect singularities 3.2 Antialias

(5)

Introduction

Overview

Our algorithm thus consist of the following steps:

1. Compute ray coefficientsC = (cpqk) 2. For each pixel (p,q)

2.1 Seek the smallest roott [0,1] of f(rpq(t)).

2.2 Compute a color for pixel (p,q).

3. Optionally, perform postprocessing 3.1 Detect singularities

3.2 Antialias

(6)

Introduction

Overview

Our algorithm thus consist of the following steps:

1. Compute ray coefficientsC = (cpqk) 2. For each pixel (p,q)

2.1 Seek the smallest roott [0,1] of f(rpq(t)).

2.2 Compute a color for pixel (p,q).

3. Optionally, perform postprocessing 3.1 Detect singularities

3.2 Antialias

(7)

Ray coefficient computation

The View Frustum Form

Idea: Parameterize the view frustum over the unit cube, s. t. (u,v,0)and (u,v,1)maps to points on the near and far plane.

p farplane

nea rplane

u v

w

L

A ray in the view frustum is given by: rpq(w) =L(p/m,q/n,w).

We define the View Frustum Formto be:

g =f ◦L: [0,1]3 →R.

(8)

Ray coefficient computation

Using the composition g =f ◦L,

f(L(p m,q

n,w)) =g(p m,q

n,w) =

d,d,d

X

i,j,k=0

gijkBid(p m)Bjd(q

n)Bkd(w)

=

d

X

k=0

d,d

X

i,j=0

gijkBid(p m)Bjd(q

n)

| {z }

cpqk

Bkd(w).

Yielding univariate ray equations of degree d,

f(rpq(t)) =

d

X

k=0

cpqkBkd(t).

(9)

Ray coefficient computation

Computing VFF Coefficients

The VFF coefficients G = (gijk) can be found in a number of ways:

I Blossoming [DeRose et.al. 1993].

I Recursion [Sederberg/Zundel 1989].

I Interpolation (our preferred approach).

I Choose (d+ 1)3 distinct interpolation points (up,vq,wr) on a grid.

I Solve

d,d,d

X

i,j,k=0

gijkBid(up)

| {z }

p

q

z }| { Bjd(uq)Bjd(ur)

| {z }

r

=f(L(up,vq,wr))

I Needs inverse of Bernstein collocation matrices Ωp= (Bid(up)).

I Use Chebyshev interpolation points for stability.

I Not dependent on the representation off.

(10)

Ray coefficient computation

Benefits of the View Frustum Form

I For fixedm,n,d – precompute basis functions

I Ck =MGkNT, M= (Bid(p/m)),N= (Bjd(q/n)).

I Can pre-evaluate inverse of collocation matrix Ω−1.

I Reduce algorithmic complexity

I Evaluation ofcpqk requires (d+ 1)2muls/adds.

I Evaluation off requires (d+ 1)(d+ 2)(d+ 3)/6 muls/adds.

I Univariate ray equations for root finding.

f(rpq(t)) =

d

X

k=0

cpqkBkd(t)

(11)

Root finding

B-Spline Based Root Finding

The univariate ray equations can be expressed as B-Splines.

Idea: Insert knot(s) at the first intersection of the control polygon. Repeat.

0.2 0.4 0.6 0.8 1.0

-4 -2 2 4

Second order convergence for simple roots [Mørken and Reimers, 2006].

(12)

Root finding

B-Spline Based Root Finding

The univariate ray equations can be expressed as B-Splines.

Idea: Insert knot(s) at the first intersection of the control polygon. Repeat.

0.2 0.4 0.6 0.8 1.0

-4 -2 2 4

Second order convergence for simple roots [Mørken and Reimers, 2006].

(13)

Root finding

B-Spline Based Root Finding

The univariate ray equations can be expressed as B-Splines.

Idea: Insert knot(s) at the first intersection of the control polygon. Repeat.

0.2 0.4 0.6 0.8 1.0

-4 -2 2 4

Second order convergence for simple roots [Mørken and Reimers, 2006].

(14)

Root finding

B-Spline Based Root Finding

The univariate ray equations can be expressed as B-Splines.

Idea: Insert knot(s) at the first intersection of the control polygon. Repeat.

0.2 0.4 0.6 0.8 1.0

-4 -2 2 4

Second order convergence for simple roots [Mørken and Reimers, 2006].

(15)

Root finding

B-Spline Based Root Finding

The univariate ray equations can be expressed as B-Splines.

Idea: Insert knot(s) at the first intersection of the control polygon. Repeat.

0.2 0.4 0.6 0.8 1.0

-4 -2 2 4

Second order convergence for simple roots [Mørken and Reimers, 2006].

(16)

Root finding

B-Spline Based Root Finding

The univariate ray equations can be expressed as B-Splines.

Idea: Insert knot(s) at the first intersection of the control polygon. Repeat.

0.2 0.4 0.6 0.8 1.0

-4 -2 2 4

Second order convergence for simple roots [Mørken and Reimers, 2006].

(17)

Root finding

B-Spline Based Root Finding

The univariate ray equations can be expressed as B-Splines.

Idea: Insert knot(s) at the first intersection of the control polygon. Repeat.

0.2 0.4 0.6 0.8 1.0

-4 -2 2 4

Second order convergence for simple roots [Mørken and Reimers, 2006].

(18)

Root finding

B-Spline Based Root Finding

The univariate ray equations can be expressed as B-Splines.

Idea: Insert knot(s) at the first intersection of the control polygon. Repeat.

0.2 0.4 0.6 0.8 1.0

-4 -2 2 4

Second order convergence for simple roots [Mørken and Reimers, 2006].

(19)

Root finding

Properites of rootfinder

I Stable computations (convex combinations)

I Similar to Newtons, but unconditionally convergent to smallest zero (no guessing)

I Quadratic convergence rate to simple zeros

I Recent extension [Mørken/Reimers] converge quadratically to multiple zeros

I Similar method [Reimers] for computing e.g. maxf(x) or min|f(x)|

(20)

Root finding

Root finding variations

The knot insertion framework is very flexible, and allow for variations:

I Can emulate B´ezier subdivision by inserting d knots at a time.

(Lane/Risenfeld, Rockwood, Schneider).

I “Preconditioning”, insert knots from neighboring rays.

I Estimate root multiplicity and detect roots of n’th derivative.

(Strictly alternating control polygon.)

I Detect critical points, use as start value to search for singularities.

(21)

Postprocessing

Singularity detection

1. For misses, find smallest absolute value along ray,w0. 2. Flag as singularity if:

|g(p/m,q/n,w0)|+ k ∇g(p/m,q/n,w0)k

< .

I How to determine?

I Vulnerable to scaling.

x2−y3 = 0.

(22)

Postprocessing

Antialiasing

Due to discrete sampling, aliasing effects will occur.

I Suppose neighboring pixelsp1,p2 differ.

I I.e. ∇p1· ∇p2< .

I We seek a pointson the separating curve betweenp1 andp2.

I color(p1) :=

(1.0−α)color(p1) +α color(p2)

silhouette

p1 p2

s= (u,v)

u v

n2

α

(23)

Postprocessing

Antialiasing II

At silhouettes

g(s) = 0 andgw(s) = 0.

I Use Newton methods on h(v,w) :=

(g(s),gw(s)) = (0,0).

I Restrict to plane betweenp1,p2.

I If leaving domain, search for g(s) = 0.

(24)

Postprocessing

Gallery and performance

(25)

Postprocessing

Future work

I Interval spline methods:

I Topological correctness.

I Empty-space skipping.

I Bounding box calculations

I Efficient data structures for splines

(26)

Postprocessing

Thank you for listening

Questions?

Contact info

I Johan S. Seland

I <[email protected]>

I Tel: +47 97 18 16 14

(27)

Postprocessing

Mørken and Reimers

An unconditionally convergent method for computing zeros of splines and polynomials

Math. of Comp. 76, 2006

(28)

Postprocessing

Zero Algorithm [MrkenReimers 2007]

Idea: Repeated knot insertion at zeros ofFt

Repeat for j = 0,1,· · · until convergence or Ftj has no zeros 1. Find the smallest valuexj+1 such thatFtj(xj+1) = 0 or stop 2. Let tj+1=tj ∪ {xj+1}and formFtj+1

0.2 0.4 0.6 0.8 1

-1 -0.75 -0.5 -0.25 0.25 0.5

Error|xjz|: 1.41e-1

3.48e-2 1.31e-2 1.26e-3 1.46e-4 1.42e-6 1.70e-8 1.61e-12 2.30e-16 2.08e-24

(29)

Postprocessing

Zero Algorithm [MrkenReimers 2007]

Idea: Repeated knot insertion at zeros ofFt

Repeat for j = 0,1,· · · until convergence or Ftj has no zeros 1. Find the smallest valuexj+1 such thatFtj(xj+1) = 0 or stop 2. Let tj+1=tj ∪ {xj+1}and formFtj+1

0.2 0.4 0.6 0.8 1

-1 -0.75 -0.5 -0.25 0.25 0.5

Error|xjz|: 1.41e-1 3.48e-2

1.31e-2 1.26e-3 1.46e-4 1.42e-6 1.70e-8 1.61e-12 2.30e-16 2.08e-24

(30)

Postprocessing

Zero Algorithm [MrkenReimers 2007]

Idea: Repeated knot insertion at zeros ofFt

Repeat for j = 0,1,· · · until convergence or Ftj has no zeros 1. Find the smallest valuexj+1 such thatFtj(xj+1) = 0 or stop 2. Let tj+1=tj ∪ {xj+1}and formFtj+1

0.2 0.4 0.6 0.8 1

-1 -0.75 -0.5 -0.25 0.25 0.5

Error|xjz|: 1.41e-1 3.48e-2 1.31e-2

1.26e-3 1.46e-4 1.42e-6 1.70e-8 1.61e-12 2.30e-16 2.08e-24

(31)

Postprocessing

Zero Algorithm [MrkenReimers 2007]

Idea: Repeated knot insertion at zeros ofFt

Repeat for j = 0,1,· · · until convergence or Ftj has no zeros 1. Find the smallest valuexj+1 such thatFtj(xj+1) = 0 or stop 2. Let tj+1=tj ∪ {xj+1}and formFtj+1

0.2 0.4 0.6 0.8 1

-1 -0.75 -0.5 -0.25 0.25 0.5

Error|xjz|: 1.41e-1 3.48e-2 1.31e-2 1.26e-3

1.46e-4 1.42e-6 1.70e-8 1.61e-12 2.30e-16 2.08e-24

(32)

Postprocessing

Zero Algorithm [MrkenReimers 2007]

Idea: Repeated knot insertion at zeros ofFt

Repeat for j = 0,1,· · · until convergence or Ftj has no zeros 1. Find the smallest valuexj+1 such thatFtj(xj+1) = 0 or stop 2. Let tj+1=tj ∪ {xj+1}and formFtj+1

0.2 0.4 0.6 0.8 1

-1 -0.75 -0.5 -0.25 0.25 0.5

Error|xjz|: 1.41e-1 3.48e-2 1.31e-2 1.26e-3 1.46e-4

1.42e-6 1.70e-8 1.61e-12 2.30e-16 2.08e-24

(33)

Postprocessing

Zero Algorithm [MrkenReimers 2007]

Idea: Repeated knot insertion at zeros ofFt

Repeat for j = 0,1,· · · until convergence or Ftj has no zeros 1. Find the smallest valuexj+1 such thatFtj(xj+1) = 0 or stop 2. Let tj+1=tj ∪ {xj+1}and formFtj+1

0.2 0.4 0.6 0.8 1

-1 -0.75 -0.5 -0.25 0.25 0.5

Error|xjz|: 1.41e-1 3.48e-2 1.31e-2 1.26e-3 1.46e-4 1.42e-6

1.70e-8 1.61e-12 2.30e-16 2.08e-24

(34)

Postprocessing

Zero Algorithm [MrkenReimers 2007]

Idea: Repeated knot insertion at zeros ofFt

Repeat for j = 0,1,· · · until convergence or Ftj has no zeros 1. Find the smallest valuexj+1 such thatFtj(xj+1) = 0 or stop 2. Let tj+1=tj ∪ {xj+1}and formFtj+1

0.2 0.4 0.6 0.8 1

-1 -0.75 -0.5 -0.25 0.25 0.5

Error|xjz|: 1.41e-1 3.48e-2 1.31e-2 1.26e-3 1.46e-4 1.42e-6 1.70e-8

1.61e-12 2.30e-16 2.08e-24

(35)

Postprocessing

Zero Algorithm [MrkenReimers 2007]

Idea: Repeated knot insertion at zeros ofFt

Repeat for j = 0,1,· · · until convergence or Ftj has no zeros 1. Find the smallest valuexj+1 such thatFtj(xj+1) = 0 or stop 2. Let tj+1=tj ∪ {xj+1}and formFtj+1

0.2 0.4 0.6 0.8 1

-1 -0.75 -0.5 -0.25 0.25 0.5

Error|xjz|: 1.41e-1 3.48e-2 1.31e-2 1.26e-3 1.46e-4 1.42e-6 1.70e-8 1.61e-12

2.30e-16 2.08e-24

(36)

Postprocessing

Zero Algorithm [MrkenReimers 2007]

Idea: Repeated knot insertion at zeros ofFt

Repeat for j = 0,1,· · · until convergence or Ftj has no zeros 1. Find the smallest valuexj+1 such thatFtj(xj+1) = 0 or stop 2. Let tj+1=tj ∪ {xj+1}and formFtj+1

0.2 0.4 0.6 0.8 1

-1 -0.75 -0.5 -0.25 0.25 0.5

Error|xjz|: 1.41e-1 3.48e-2 1.31e-2 1.26e-3 1.46e-4 1.42e-6 1.70e-8 1.61e-12 2.30e-16

2.08e-24

(37)

Postprocessing

Zero Algorithm [MrkenReimers 2007]

Idea: Repeated knot insertion at zeros ofFt

Repeat for j = 0,1,· · · until convergence or Ftj has no zeros 1. Find the smallest valuexj+1 such thatFtj(xj+1) = 0 or stop 2. Let tj+1=tj ∪ {xj+1}and formFtj+1

0.2 0.4 0.6 0.8 1

-1 -0.75 -0.5 -0.25 0.25 0.5

Error|xjz|: 1.41e-1 3.48e-2 1.31e-2 1.26e-3 1.46e-4 1.42e-6 1.70e-8 1.61e-12 2.30e-16 2.08e-24

(38)

Postprocessing

Zero Algorithm [MrkenReimers 2007]

Idea: Repeated knot insertion at zeros ofFt

Repeat for j = 0,1,· · · until convergence or Ftj has no zeros 1. Find the smallest valuexj+1 such thatFtj(xj+1) = 0 or stop 2. Let tj+1=tj ∪ {xj+1}and formFtj+1

0.2 0.4 0.6 0.8 1

-1 -0.75 -0.5 -0.25 0.25 0.5

Error|xjz|: 1.41e-1 3.48e-2 1.31e-2 1.26e-3 1.46e-4 1.42e-6 1.70e-8 1.61e-12 2.30e-16 2.08e-24

Referanser

RELATERTE DOKUMENTER

она провела встречи в Мурманске для приемки автоматизированной централизованной системы радиационного мониторинга площадки временного хранения контейнеров с

We have rerun the neon model with photoionization, but using the oxygen collision cross sections, and this causes the maximum relative neon abundance (after 3 hr) to increase from

Overall, the SAB considered 60 chemicals that included: (a) 14 declared as RCAs since entry into force of the Convention; (b) chemicals identied as potential RCAs from a list of

Azzam’s own involvement in the Afghan cause illustrates the role of the in- ternational Muslim Brotherhood and the Muslim World League in the early mobilization. Azzam was a West

At each level of recursion we count the number of sign changes in the coefficients, and if both sets of coefficients contain sign changes we choose to continue to subdivide the

There had been an innovative report prepared by Lord Dawson in 1920 for the Minister of Health’s Consultative Council on Medical and Allied Services, in which he used his

Interactive and real-time visual exploration of volumetric and time-resolved cardio- vascular blood-flow velocity data, communicated through simplified representations,

Firstly, in order to simplify the creation of realistic scenes, we developed an automated realistic high dynamic range daylight simulation based on correct physical data that is