Quote: "Hey does anyone know if it is possible to define objects render sequence so it is possible to control that an object will render in front of another, and still make it render behind other objects?"
Yes it is possible, but it requires a good organization of IDs for textures or objects, or at least that's how I do it
By default any object (Object_A) will appear behind any other objects with a higher Texture ID, if you set on it Disable Object ZRead:
Disable Object ZRead Object_A
Here is a full example, hold the spacekey to Enable/Disable Object ZRead over the plane object:
`make textures so you don't need any media
create bitmap 1,screen width(),screen height()
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
print "Testing Draw To Back : Testing Draw To Back : Testing Draw To Back"
get image 1,0,0,screen width(),screen height()
cls
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
print "Object : Object : Object : Object : Object : Object : Object"
get image 2,0,0,screen width()/2,screen height()/2
cls
print "Testing Draw To Front : Testing Draw To Front : Testing Draw To Front : Testing Draw To Front"
print "Testing Draw To Front : Testing Draw To Front : Testing Draw To Front : Testing Draw To Front"
print "Testing Draw To Front : Testing Draw To Front : Testing Draw To Front : Testing Draw To Front"
print "Testing Draw To Front : Testing Draw To Front : Testing Draw To Front : Testing Draw To Front"
print "Testing Draw To Front : Testing Draw To Front : Testing Draw To Front : Testing Draw To Front"
print "Testing Draw To Front : Testing Draw To Front : Testing Draw To Front : Testing Draw To Front"
print "Testing Draw To Front : Testing Draw To Front : Testing Draw To Front : Testing Draw To Front"
print "Testing Draw To Front : Testing Draw To Front : Testing Draw To Front : Testing Draw To Front"
print "Testing Draw To Front : Testing Draw To Front : Testing Draw To Front : Testing Draw To Front"
print "Testing Draw To Front : Testing Draw To Front : Testing Draw To Front : Testing Draw To Front"
print "Testing Draw To Front : Testing Draw To Front : Testing Draw To Front : Testing Draw To Front"
print "Testing Draw To Front : Testing Draw To Front : Testing Draw To Front : Testing Draw To Front"
get image 3,0,0,screen width()/2,screen height()/5
cls
delete bitmap 1
set current bitmap 0
`Here is actual code
sync on: sync rate 60
autocam off
color backdrop 0
position camera 0,0,-7.7
`make plain to use for drawing to the back
make object plain 1,12,8
texture object 1, 1
set object transparency 1,1
`make object for middle drawing
make object sphere 2,5
texture object 2, 2
position object 2,0,0,5
`use sprite to draw in front
sprite 3,screen width()/3,screen height()/3,3
direction = 1
do
if direction = 1
position object 2,0,0,object position z(2) + .05
if object position z(2) >= 7
direction = 0
endif
endif
if direction = 0
position object 2,0,0,object position z(2) - .05
if object position z(2) <= -2
direction = 1
endif
endif
if spacekey() = 0
disable object zread 1
else
enable object zread 1
endif
set cursor 5,5
print object position z(2)
set cursor 5,20
if object position z(2) >= 3
print "Sphere is behind plain"
endif
if object position z(2) <= 1
print "Sphere is in front of plain"
endif
sync
loop
In other words, disable object zread gives priority by image numbers. The objects you want drawn behind others need to have the lowest image numbers.
Quote: "At one point I think it drew things in order of texture number, but I think with the current version it's different. Sucks because it screwed up the explosion rendering in my big project."
Well, I haven't updated to 7.5, but here everything works fine. Try the example above to see if the plane stays behind the sphere when it has disabled object zread.
There was an improvement regarding all this since DBPro 7.3 (I think). It was the Set Global Object Creation mode. It seems that it allows to use the Object ID instead of the Texture ID.
So all that has been said will be true but for Object IDs, instead of Texture IDs, if you set:
Set Global Object Creation 2
This is what the manual says about it:
Quote: "SET GLOBAL OBJECT CREATION
This command will set the creation mode of the object manager.
Syntax
SET GLOBAL OBJECT CREATION Creation Mode
Parameters
Creation Mode
Integer
A Creation Mode of 0 is the default, whereas 1 will force the objects to share vertex buffers, 2+3 stops texture sorting, 4+5 uses sort by number and 6+7 sorts by depth.
Returns
This command does not return a value.
Description
A Creation Mode of zero is the default, whereas a value of one will force the objects to share vertex buffers where possible. Vertex buffers are the internal memory resource the
engine uses to store all geometry data before it is rendered to the screen. By sharing vertex buffers, you can gain performance on some 3D cards, but not others. By default vertex
buffers are not shared for the sake of widest compatibility, better generic performance and less prone to buffer overruns. Additionally, objects that share vertex buffers take longer
to delete as they must be disentangled from its buffer on removal."


And this is the advice of Mr. Lee Bamber:
Quote: "Set Global Object Creation 2
Add this at the top of your program and all objects handled in your application use 'sort by object order' rather than 'sort by texture number'.
What this means is that there is no expensive bubble sort each time new objects are introduced into the engine, and so loading and main loop performance may increase slightly.
The downside is that the GPU will be asked to continually swap textures back and forth with no care to render all objects that share a common texture.
In some cases, this will degrade performance based on your scene complexity. Either way, it is another little tweak you may wish to experiment with to gain a few extra FPS from your projects."
I hope all this gives some light over the subject. I use the default texture sorting when needed, as described at the beginning