VertexColour limits?

Blitz3D Forums/Blitz3D Beginners Area/VertexColour limits?

_PJ_(Posted 2010) [#1]
Are there limits to the use of VertexColor? As in, number of verts that may be coloured?

Maybe I've done something wrong elsewhere, but I've not been able to find it at all. . .
The code below shows the mesh being generated and only half of it gets coloured...




jfk EO-11110(Posted 2010) [#2]
I didn't even know that you can do this:

Global Points[21900]

shouldn't this be
Dim Points(21900)

A simple integer array that is global by default?

BTW. I don't think there is such a limit as you described, because I remember some people used Alpha-Splatting with mesh terrains often up to the max number of vertices, that may be a signed or unsigned 16 Bit number (32K or 64K).


Floyd(Posted 2010) [#3]
There must be some flaw in the code. The problem is not the number of vertices.

BuildGraph() uses two loops, with Step 3 and Step 2. Change those to 30 and 20. Now there about a hundredth as many vertices, yet the behavior is the same: Bottom half is uncolored.

Last edited 2010


_PJ_(Posted 2010) [#4]


Global Points[21900]

shouldn't this be
Dim Points(21900)



Essentially, it's the same thing, but since the array is 1 dimensional, the Blitz Arrays ( [] type) work fine, with the advantage that they can be passed as arguments to a function.
Just personal preference I guess ;)

There must be some flaw in the code. The problem is not the number of vertices.

BuildGraph() uses two loops, with Step 3 and Step 2. Change those to 30 and 20. Now there about a hundredth as many vertices, yet the behavior is the same: Bottom half is uncolored.




Yeah, as you can see with the various commented out lines, I tried a few different methods of colouring but each to no avail...
All I can think is that I'm not iterating through the entirety of all the verts/triangles, but I just can't find out why or where that is :S
I'll keep playing around, at least it's good to know it's not a blitz, DX limit... unless perhaps it's a problem wioth my graphics card/memory? But then, others wouldn't necessarily have the issue, right?

All I can think of,m


jfk EO-11110(Posted 2010) [#5]
I don't see why you remarked those lines:

;VertexColor Surface,n+3,VertexX(Surface,n+3),VertexY(Surface,n+3),VertexZ(Surface,n+3)
;VertexColor Surface,n+4,VertexX(Surface,n+4),VertexY(Surface,n+4),VertexZ(Surface,n+4)
;VertexColor Surface,n+5,VertexX(Surface,n+5),VertexY(Surface,n+5),VertexZ(Surface,n+5)

although you created these:

v3=AddVertex(Surface,EntityX(Points[n+3],True),EntityY(Points[n+3],True),EntityZ(Points[n+5],True))
v4=AddVertex(Surface,EntityX(Points[n+4],True),EntityY(Points[n+4],True),EntityZ(Points[n+5],True))
v5=AddVertex(Surface,EntityX(Points[n+5],True),EntityY(Points[n+5],True),EntityZ(Points[n+5],True))

and then expect them to be colored ?

And an other thing that might be important:

I see you are creating two Triangles at absolutely the same position:
AddTriangle(Surface,v3,v1,v2)
...
AddTriangle(Surface,v3,v1,v2)



I cannot imagine why you want to do that. Even for Alpha splatting you should not use the same locations AFAIK. But beside waste of Tris and Z-Fighting issues with alpha splatting, there's a much more significant problem with such Clone Triangles: on some Cards they cause massive, bugous slowdowns in the rendering pipeline, a problem with Z-sorting.

Last edited 2010


jfk EO-11110(Posted 2010) [#6]
Howdy Malice, let me know what it was :)


_PJ_(Posted 2010) [#7]
Oops, couldn't find this thread again, It ought to be in the 3D section really...

Anyway, it's pretty clear that although I understand the concept of vertixces, surfaces and triangles etc. I need to think a bit more on the 3D geometry side.

The creation of the actual points (based on setting pivots to mark the vert positions) is pretty poor, since it's hard to then identify which verts should be linked for triangles.

Thanks for spotting the mistakes there, jfk, though uncommenting the colouring lines for v3,4,5 etc. doesn't make a difffference, alluding, perhaps, to even more triangles overlapping and "hiding" the coloured ones?

Seems the whole thing is a mess and really could do with a clean, fresh start, possibly with a more methodical approach...


jfk EO-11110(Posted 2010) [#8]
As far as I see it was only a little further bug, step 6, not step 3:



_PJ_(Posted 2010) [#9]
HAH!

That's brilliant! Perfect! Thanks so much, jfk... I think ater a while of looking through the same code, one gets blind to the obvious!

That seems to be working just as it should do. That's really made a huge difference, thank you!