Sign in to follow this  
wishes

Usage Texture3D with VolumetricData

Recommended Posts

wishes    100
Hi
i am new to XNA(4.0) and C#. I've got to solve to following problem:
i've got an dataset, from which i can create a Texture3D (its a set of volumetric data, a box and within this box there is a volume with value != 0, i have to map these values to colors, while 0 == Color.Transparent).

The Problem is i don't know how to use these Texture3D i created from the data.

I created a bounding box, but i really have no clue how to put the Texture3D on it.

http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.texture3d.aspx
So do i have to use a RenderTargetCube? This is just one Set, so no MipMap Levels? I only found examples for RenderTarget2D.

Or is this done in the Effect file?

This is my Effect1.fx:
http://csharp.pastebin.com/P71aVypk

And the DefaultEffect.cs:
http://csharp.pastebin.com/uFPxezAc

And the BoundingBox.cs:
http://csharp.pastebin.com/0dKc2Szk

Any Tips or Hints in which direction i should go?

Share this post


Link to post
Share on other sites
SuperVGA    1132
You should run a pixel shader on it, traversing through the bounding box while sampling the Texture3D.
AFAIK there's no fixed functionality to render a 3D texture as a volume.
(But sure, you can apply the texture to polygons, only I think you'd better stick with the pixel shader raycaster)

Share this post


Link to post
Share on other sites
wishes    100
Well, i am trying to, but at the moment i am quite overwhelmed. The problem is also that at dont really unterstand the explanation of the Texture3D in the Library Reference,in my understanding i can use a normal 2dtexture sampler, and the slices getting rendered with RenderTargetCubes... but i dont understand how to bound those RenderTargetCubes.... an all examples are for Environmentmapping, Skydomes ...

Share this post


Link to post
Share on other sites
SuperVGA    1132
Quote:
Original post by swiftcoder
Did you click the link I provided? It is an exact tutorial of volume texture ray casting in XNA...
I'm not sure why that link won't work here, a little less perma here:
Older posts...
As Tristam points out, a tiny little bit of googlin' should do the job of getting some good papers.

And, I know you're using DX but these cover the topic well also:

Peter Triers blog
John Pawasauskas' old theory

Its basics are trivial, you should've implemented in no time after a little understanding. Its optimizations are not. :/

[Edited by - SuperVGA on November 10, 2010 12:09:16 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this