pseudo volume rendering

Blitz3D Forums/Blitz3D Programming/pseudo volume rendering

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