Questions about Meshes

Blitz3D Forums/Blitz3D Programming/Questions about Meshes

JBR(Posted 2004) [#1]
Hello, just starting out in 3D and have a few Questions about meshes, surfaces and brushes.

1) I think I read somewhere that having just 1 mesh is faster than having many. Is this equally true for meshes with and without textures? Any rules to follow?

2) When you add a surface with a brush to a mesh will changing the brush attributes result in a change in the surface. i.e. if you change the BrushAlpha after setting up the surface then can you fade in/out the surface dynamically by changing the brush?

3) Lets say a mesh has 10 surfaces; now when I add a vertex to any surface will the first vertex number in each be 0 then 1 then 2 etc? i.e. all surfaces start with unique vertex number 0 and work up. Seems logical to do so but not sure.

4) I know vertex numbers start at 0 and work up but can the same be said for surface numbers? i.e. if I create 5 surfaces can I access them by 0,1,2,3,4 or do surface handles behave differently?

Any advice appreciated
Thank
Marg


Ricky Smith(Posted 2004) [#2]
3 - A single mesh has unique vertex id's regardless of the number of surfaces. A single mesh will only have 1 vertex id 0 etc.


WolRon(Posted 2004) [#3]
1 - I believe this is supposed to be 1 surface, not 1 mesh, but I could be wrong.


JBR(Posted 2004) [#4]
Hello, wrote a little prog and a new surface always starts from vertex 0.

i.e. vert = addvertex( surf, 0,0,0) ----> vert = 0
vert = addvertex( surf, 0,0,0) ----> vert = 1
vert = addvertex( ssss, 0,0,0) ----> vert = 0

so this answers (3)

As for (4) surfaces numbers are big integers so I don't think you can access like vertices.

Can anyone clarify (1) & (2) a bit more?

Thanks
Marg


AbbaRue(Posted 2004) [#5]
In answer to 2) if I understand the question right.
If you change the colour of any pixels in the texture on the fly,
all uses of that texture will imediately change. I have tried this.
But I haven't tried changing alpha, on the fly. But alpha is actually the 4th byte of a pixel.
So it should change the same as the other colours I would think.
So fading should work on the fly.
Here is some code for creating a tree texture.

ts=512
tex57=CreateTexture (ts,ts,15)
SetBuffer TextureBuffer (tex57,0)
For cdy= 0 To ts-1
For cdx= 0 To ts-1
rca=255
rcg=Rnd(0,150)
rcr=Int(rcg/2)
rcb=Int(rcg/4)
argb=0 ;clear color
argb=(rca Shl 24) Or (rcr Shl 16) Or (rcg Shl 8) Or (rcb)
;If rcg<74 Then argb=0 ;just to be sure lots of black
WritePixel cdx,cdy,argb

Next
Next

SetBuffer BackBuffer()

Try to texture an image with it and then change the value of 'rca' on the fly and see if the texture fades out or in.

Hope that helps.