Help SkyBox

Blitz3D Forums/Blitz3D Programming/Help SkyBox

Yue(Posted 2012) [#1]
I am creating a skybox, now do not know how to bind the corners where the surfaces are not known.




[bbcode]
Function SkyBox(Frente$="",Derecha$="")

Local Cubo% = CreateMesh()
Local Brocha% = LoadBrush(Frente$)
Local Superficie% = CreateSurface(Cubo%,Brocha%)


AddVertex (Superficie%,-1,1,1,0,0)
AddVertex (Superficie%,1,1,1,1,0)
AddVertex (Superficie%,1,-1,1,1,1)
AddVertex (Superficie%,-1,-1,1,0,1)


AddTriangle (Superficie%,0,1,2)
AddTriangle (Superficie%,3,0,2)
FreeBrush (Brocha%)


Brocha% = LoadBrush(Derecha$)
Superficie% = CreateSurface(Cubo%,Brocha%)


AddVertex (Superficie%,1,1,1,0,0)
AddVertex (Superficie%,1,1,-1,1,0)
AddVertex (Superficie%,1,-1,-1,1,1)
AddVertex (Superficie%,1,-1,1,0,1)


AddTriangle(Superficie%,0,1,2)
AddTriangle(Superficie%,3,0,2)



FreeBrush (Brocha%)






EntityFX Cubo%,1



Return Cubo%


End Function

[/bbcode]


RemiD(Posted 2012) [#2]
You can try 2 things :

->When the program loads the texture, use the flags +16+32
or
->Set the UV coordinates of your vertices with a slight offset towards the center of the texture :

Example for the quad at +Z of a skybox with a width, height, depth of 1 (you can scale it later) :
UOffset# = 0.001
VOffset# = 0.001
AddVertex (Surface, -0.5, 0.5, 0.5, 0.000+UOffset#, 0.000+VOffset#)
AddVertex (Surface, 0.5, 0.5, 0.5, 1.000-UOffset#, 0.000+VOffset#)
AddVertex (Surface, -0.5, -0.5, 0.5, 0.000+UOffset#, 1.000-VOffset#)
AddVertex (Surface, 0.5, -0.5, 0.5, 1.000-UOffset#, 1.000-VOffset#)
AddTriangle (Surface,0,1,2)
AddTriangle (Surface,2,1,3)

Then you change the UOffset# and VOffset# values until you don't see the black border.
Please note that you also have to do these tweaks for the others quads of the skybox.

Last edited 2012


Yue(Posted 2012) [#3]
@RemiD
Thanks You.



I've settled on the flag at the time of loading the brush. Now I have a question from where the flag 49, I see that also works, and the flag is not on the load information of textures or brushes.


Kryzon(Posted 2012) [#4]
You're adding +1 to 48.

1 is the "Color" flag, which doesn't make any visual difference but as I recall it increases compatibility with exotic hardware. I think Yasha may know more about this.

Prefer to use 49.


Yasha(Posted 2012) [#5]
All I know about this is that failing to use flag 1 can cause crashes or disappeared textures on some devices. No idea why.