Where the bug belongs? (Fast Extension)

Blitz3D Forums/Blitz3D Userlibs/Where the bug belongs? (Fast Extension)

Moraldi(Posted 2008) [#1]
1. Load the 'FastExt_Example_BumpEffects' file
2. Change the value from 64 to 128 in the line
tex_bump1 = LoadTexture("..\media\tenbm.jpg",64)

You've just got a 'Texture does not exist' message, from Blitz3D


Mortiis(Posted 2008) [#2]
It's not a bug. Texture filter 64 is spherical environment mapping while 128 is cubic environment mapping. Therefore you need a cubic texture map to apply that filter for cube mapping.


Moraldi(Posted 2008) [#3]
Thank you Sarper, but Blitz3D reports that the texture does not exist. There is no matter whether it is spherical or cubic mapping, the texture still exists in hard drive...
Moreover I don't know what kind of texture I must use when I need cubic environment.


Mortiis(Posted 2008) [#4]
You have to either create it in your code by rendering 6 sides of the cubemapped mesh or load a custom pre-rendered cube map.

Here is the B3D cubemapping example code;

Function UpdateCubemap(tex,camera,entity,ocam,flat=True,refraction=True)

	If tex<>0 
		CameraProjMode ocam,0
		CameraRange	camera,1.0,10000.0
	
		tex_sz=TextureWidth(tex)

		; Show the camera we have specifically created for updating the cubemap
		ShowEntity camera
	
		; Hide entity that will have cubemap applied to it. This is so we can get cubemap from its position, without it blocking the view
		HideEntity entity

		; Position camera where the entity is - this is where we will be rendering views from for cubemap
		If flat
			PositionEntity camera,EntityX#(ocam,True),EntityY#(entity,True)-(EntityY(ocam,True)-EntityY(entity,True)),EntityZ(ocam,True)
		Else
			PositionEntity camera,EntityX#(entity,True),EntityY#(entity,True),EntityZ#(entity,True)
		End If

		CameraClsMode camera,False,True
	
		; Set the camera's viewport so it is the same size as our texture - so we can fit entire screen contents into texture
		CameraViewport camera,0,0,tex_sz,tex_sz

		; Update cubemap

		; do left view	
		SetCubeFace tex,0
		RotateEntity camera,0,90,0
		RenderWorld
		CopyRect 0,0,tex_sz,tex_sz,0,0,BackBuffer(),TextureBuffer(tex)
	
		; do forward view
		SetCubeFace tex,1
		RotateEntity camera,0,0,0
		RenderWorld
		CopyRect 0,0,tex_sz,tex_sz,0,0,BackBuffer(),TextureBuffer(tex)
	
		; do right view	
		SetCubeFace tex,2
		RotateEntity camera,0,-90,0
		RenderWorld
		CopyRect 0,0,tex_sz,tex_sz,0,0,BackBuffer(),TextureBuffer(tex)
	
		; do backward view
		SetCubeFace tex,3
		RotateEntity camera,0,180,0
		RenderWorld
		CopyRect 0,0,tex_sz,tex_sz,0,0,BackBuffer(),TextureBuffer(tex)
	
		; do up view
		SetCubeFace tex,4
		RotateEntity camera,-90,0,0
		RenderWorld
		CopyRect 0,0,tex_sz,tex_sz,0,0,BackBuffer(),TextureBuffer(tex)

		; do down view
		SetCubeFace tex,5
		RotateEntity camera,90,0,0
		RenderWorld
		CopyRect 0,0,tex_sz,tex_sz,0,0,BackBuffer(),TextureBuffer(tex)
	
		; Show entity again
		ShowEntity entity
	
		; Hide the cubemap camera
		HideEntity camera

		CameraProjMode ocam,1
	End If
		
End Function


I don't know what kind of texture I must use when I need cubic environment.


Here, it's what it looks like;




Moraldi(Posted 2008) [#5]
Great help. Thanks!