pseudo volume rendering

Blitz3D Forums/Blitz3D Programming/pseudo volume rendering

shawnus(Posted 2007) [#1]
All,

Is it possible to emulate volume rendering by 'stretching' the mesh of a model in line with the camera clip value of a camera?

For example, if you can imagine a camera on the moon with a narrow camera clip set eg. a quarter inside the earth and the camera was to freely rotate around the earth, would it be possible to interactively vary the camera clip distance whilst simultaneously 'orbiting' the object (earth) and have the polygons of the object 'stretched' so that the inside looked solid from any angle and depth (I hope this makes sense)?

In other words, if I was to create a very narrow camera clip, put the camera in front of a (surface rendered) sphere and slowly move the camera clip range inside the sphere, can I create the illusion of a flat surface just in front of the camera so the object I am inside appears solid?

cheers, Shawnus


bytecode77(Posted 2007) [#2]
no, it doesnt mak sense :)
there are only a few shadow rendering techniques. and there wont be no more!

by reading your post, i first thought you were talking about depth shadows. they are not possible in bb and barely possible in c++


Stevie G(Posted 2007) [#3]
I think it made sense ... after 4 reads ;)

Simplest and quickest would be to disabling backface culling - EntityFx MyMesh, 16.

Any other alternatives would involve clipping the mesh manually. See below from big10p - providing you can rebuild the poly's which sit on the clip plane it could be adapted.

http://www.blitzbasic.com/codearcs/codearcs.php?code=1143

Stevie


jfk EO-11110(Posted 2007) [#4]
cliping the polies may be pretty slow. A further solution coul d be:
render the solid material as a simple quad or cube that covers the screen, with the correct distance to the camera,(maybe use a 2nd camera for this, far from the world center) then render the scene with the "holes" produced by things that are clipped using a CameraClsMode that will not erase the background. Now the solid material should be visible in the holes, with dynamic scaling etc so textures look right.


shawnus(Posted 2007) [#5]
thanks all, I apologise for my poor explination but I think Stevie G is closest to what I mean.

What I am looking for is a CAT scanner (or MRI) simulator. These scanners reconstruct an image using volumetric techniques, so a slice through the body will appear 'solid'. If we did the same with lots of surface rendered anatomical models, a 'slice' through this type of body (I do this by putting a camera at the mouth of the tunnel and using a narrow camera clip range to simulate slice thickness) would reveal mostly blackness surrounded by a 'halo' of anatomical organ- either the inside or outside of the model (depending on which way the surface is bending at the time). However the interior appearance is mostly black, so it looks 'empty'.

This isnt so bad if the depth of field (the clip range) is very wide because you can see further into the inside of the model, but it looks a little unrealistic. What I tend to do here is combine the clipping plane with clipped fog so the inside 'fades away', but it still ends up looking black and empty.

I thought that if the camera clipping plane could be given world coordinates and if that the camera clip was eg. 5mm, then the model's interior surface (the inside)could be interactively reconstructed (stretched from one side of the exterior surface to the other side) say 2mm inside the camera clip, and that this interactive reconstruction could be matched on a plane parallel to the face of the camera, and move with the camera clip. This would give the appearance of a surface rendered model being 'solid'.

Its all a bit beyond me, but if the project takes off I will look into hiring someone to sort it out if its possible.

Cheers Shawnus


Stevie G(Posted 2007) [#6]
shawnus,

I think this is possible by taking an inverted copy of the mesh and parenting it to the original, slightly offset by the vertex normals.

Is this the kind of thing you mean? Use up/down cursors to move through the sphere.

Graphics3D 640,480,16,1

Global LIGHT = CreateLight() : RotateEntity LIGHT, 30,-45,0
Global CAMERA = CreateCamera() : PositionEntity CAMERA, 0,0,-3.5 

Global SPHERE = CreateSphere( 32 )
EntityColor SPHERE , 200,100,100
EntityFX SPHERE, 4

Global INSIDE = MESHinvert( SPHERE )
EntityColor INSIDE, 100,50,50
EntityFX INSIDE, 1

While Not KeyDown(1)

	TranslateEntity CAMERA , 0 , 0 , ( KeyDown(200) - KeyDown(208) ) * .002
	RenderWorld()
	Flip
	
Wend

;=======================================================================================================
;=======================================================================================================
;=======================================================================================================

Function MESHinvert( mesh , offset# = .001 )

	copy = CopyMesh( mesh , mesh )
	FlipMesh copy
	s = GetSurface( copy , 1 )
	For v = 0 To CountVertices( s ) - 1
		VertexCoords s, v , VertexX( s, v ) + VertexNX(s,v ) * offset , VertexY( s, v ) + VertexNY( s, v ) * offset , VertexZ( s, v ) + VertexNZ( s, v ) * offset
	Next
	Return copy
	
End Function


Stevie


shawnus(Posted 2007) [#7]
Stevie G

It certainly looks right- thank you very much. I will try this with my models.

This reaffirms my deep suspicions that I will in fact never be a talented developer (or even a moderately intermediate one).

Thanks once again,

Kind regards,

Shawn


Stevie G(Posted 2007) [#8]
No problem. Let us know how you get on.

Stevie