[osg-users] [osgPPU] X-ray Design use of OsgPPU

2009-08-11 Thread Bob Youmans
Hi,

I'm trying to come up with a design using OSG to build what i'm calling an 
X-ray viewer.  Basically i have relatively simple geometry, a shell or 
skin of a vehicle and then the interior.  I want to view the interior as 
penetrated by the X-rays, which is based on a thickness calculation and a 
distance and aspect angle, all hopefully done in shaders.  I envision the 
shaders setting the fragment alpha and/or color when rendering the shell, 
then after to render the interior and combine with the shell texture to 
create the final view, showing through the interior in desired parts.  Finally, 
i desire to get a histogram of the colors of the interior to see how the 
shell performed on the x-rays with the interior.

Do you see this as an appropriate application / use of osgppu?  i'm running osg 
2.8.1.  will ppu work with that.  i've got osgppu 0.4 i think.

also, i'm thinking i need to create the ppu nodes programmatically instead of 
reading ppu files, so i need examples of that type.  i'm just starting to look 
through them.


Thank you!

Cheers,
Bob

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=16090#16090





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPPU] X-ray Design use of OsgPPU

2009-08-11 Thread Art Tevs
Hi Bob,

huh, I would say it depends on your implementation. Currently the way you 
describe it requires a volumetric rendering approach. 

The thickness calculation seems to be the most tricky part. If you have your 
volume data, then use osgVolume for that (I haven't tested it, so I do not know 
how well it suits your expectations).

Other possible solution is to render all your triangles in slices which are 
perpendicular in viewing direction. So you specify clip planes and render your 
model in several passes. Of course no backface culling or any other culling 
except of this clip planes should be active.

So you render your slices into a several textures (actually you only need depth 
values). Using osgPPU you combine all that textures and compute thickness. 
After all passes (depends on complexity of your model, how much passes you want 
to use), i.e. 128 passes, you will have as result thickness of each pixel in 
viewing direction. This thickness texture can then be projected on the model in 
your scene back. Since hte projection is from the view point, you shouldn't see 
any big artifacts.

So this is a way, how I would try to do it. Maybe there exists better 
approaches.

Cheers,
art



ryoumans wrote:
 Hi,
 
 I'm trying to come up with a design using OSG to build what i'm calling an 
 X-ray viewer.  Basically i have relatively simple geometry, a shell or 
 skin of a vehicle and then the interior.  I want to view the interior as 
 penetrated by the X-rays, which is based on a thickness calculation and a 
 distance and aspect angle, all hopefully done in shaders.  I envision the 
 shaders setting the fragment alpha and/or color when rendering the shell, 
 then after to render the interior and combine with the shell texture to 
 create the final view, showing through the interior in desired parts.  
 Finally, i desire to get a histogram of the colors of the interior to see how 
 the shell performed on the x-rays with the interior.
 
 Do you see this as an appropriate application / use of osgppu?  i'm running 
 osg 2.8.1.  will ppu work with that.  i've got osgppu 0.4 i think.
 
 also, i'm thinking i need to create the ppu nodes programmatically instead of 
 reading ppu files, so i need examples of that type.  i'm just starting to 
 look through them.
 
 
 Thank you!
 
 Cheers,
 Bob


--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=16098#16098





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPPU] X-ray Design use of OsgPPU

2009-08-11 Thread Bob Youmans
Hi,

for the thickness it's actually a fixed data for the geometry (not really 
thickness).  It's only thickness in the analogue of the x-ray model.  It's 
geometry dependent data, and for starting out adding this data item and/or 
having only the one value will do.  I'm just looking for the best design using 
osg.  So with that, maybe osgVolume is not necessary.  I have userdata and/or 
node callbacks to get this data for each geometry (e.g., Uniform callback for 
the vertex shader all using the same var name).  

I found your slicing idea in osgppu interesting.  So, given this thickness as 
data and not requiring geometry calculation, how would you see going at it?


Thank you!

Cheers,
Bob

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=16106#16106





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPPU] X-ray Design use of OsgPPU

2009-08-11 Thread Art Tevs
Hello,


ryoumans wrote:
 
 for the thickness it's actually a fixed data for the geometry (not really 
 thickness).  It's only thickness in the analogue of the x-ray model.  It's 
 geometry dependent data, and for starting out adding this data item and/or 
 having only the one value will do.  I'm just looking for the best design 
 using osg.  So with that, maybe osgVolume is not necessary.  I have userdata 
 and/or node callbacks to get this data for each geometry (e.g., Uniform 
 callback for the vertex shader all using the same var name).  
 

OK, but your data must be view dependent. Otherwise how you would imagine to 
have X-ray like view, if you just have per vertex data?
Or maybe I just don't really understand what you would like to have.


 
 I found your slicing idea in osgppu interesting.  So, given this thickness 
 as data and not requiring geometry calculation, how would you see going at it?
 

Giving the thickness of data, I would render the object just as it is and using 
a shader, I would compute the viewing direction for each pixel (or vertex). 
Then having your view dependent data (so it would be probably a 6D data, for 
each position in each viewing direction. Or maybe 5D, for each position on 
surrounding sphere in each viewing direction) I would just compute color based 
on this thicknes.

I do not see currently any other way of rendering X-ray like 3D models without 
having thickness data for each viewing direction and viewing position. THe way 
I proposed, is the way how one could compute this data on the fly. Maybe we can 
work out an example usng osgPPU so that other people can profit from it ;)

cheers,
art

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=16110#16110





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPPU] X-ray Design use of OsgPPU

2009-08-11 Thread Paul Sherman

Hello,

Pardon me if I am jumping into the middle of this conversation, but  
XRay rendering has been done before. Look at shader examples from  
NVidia and others for volumetric fog and adapt them accordingly. The  
basic approach is to use the depth buffer and subtraction to render  
thickness as a bit field depth and then use that depth index for a  
lookup into your fog texture (1D) to produce the desired visual  
effect. Attenuation of the objects (different material parameters) can  
be achieved by setting values in texture units 1, 2 or 3 of the model  
(so you can still look at them visually). Modeling more advanced  
features of X-Ray light (non-linear falloff, for example) can be  
accomplished in the 1D lookup texture or it can be extended to a 2D or  
even 3D texture. Very realistic effects that mix with real objects  
can even be achieved.


Hope that helps,

- Paul

On Aug 11, 2009, at 1:15 PM, Art Tevs wrote:


Hello,


ryoumans wrote:


for the thickness it's actually a fixed data for the geometry  
(not really thickness).  It's only thickness in the analogue of the  
x-ray model.  It's geometry dependent data, and for starting out  
adding this data item and/or having only the one value will do.   
I'm just looking for the best design using osg.  So with that,  
maybe osgVolume is not necessary.  I have userdata and/or node  
callbacks to get this data for each geometry (e.g., Uniform  
callback for the vertex shader all using the same var name).




OK, but your data must be view dependent. Otherwise how you would  
imagine to have X-ray like view, if you just have per vertex data?

Or maybe I just don't really understand what you would like to have.




I found your slicing idea in osgppu interesting.  So, given this  
thickness as data and not requiring geometry calculation, how  
would you see going at it?




Giving the thickness of data, I would render the object just as it  
is and using a shader, I would compute the viewing direction for  
each pixel (or vertex). Then having your view dependent data (so it  
would be probably a 6D data, for each position in each viewing  
direction. Or maybe 5D, for each position on surrounding sphere in  
each viewing direction) I would just compute color based on this  
thicknes.


I do not see currently any other way of rendering X-ray like 3D  
models without having thickness data for each viewing direction and  
viewing position. THe way I proposed, is the way how one could  
compute this data on the fly. Maybe we can work out an example usng  
osgPPU so that other people can profit from it ;)


cheers,
art

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=16110#16110





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPPU] X-ray Design use of OsgPPU

2009-08-11 Thread Bob Youmans
Hi,

yes view dependent ok.  imagine a vehicle, each geode is a panel and the 
panel has a thickness.  i plan to  set a distance for the x-ray and a 
viewing angle (about z, assume constant elevation (about x or y), render 
a frame and see what interior geometry fraction shows through by counting the 
pixels as the ratio of num of colored pixels.  for the next frame, the viewing 
angle and/or distance will change.  Note that the distance only serves to 
effect the power (vs thickness) of the x-ray so that as the viewing pos is 
closer more penetration can occur.

i would be interested in how to set this up as a multi-render ppu arrangement.  
My geometry is in a file, but there are several other nodes i create 
programmatically to make all this work.

My problem is i'm very new with textures and shading and it's difficult to 
debug, compared to the usual development approach.

right now i don't know the best way to set up the shader / texture / pixel 
objects.  I'm ok with the osg nodes and have the transforms and callbacks ok.  
even the uniforms per geode are ok.

i'm looking at depthpeeling and several other examples from osg to find the way 
to go with the shader pixel analysis parts.

... 


Thank you!

Cheers,
Bob

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=16111#16111





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org