Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Meshes- How can I use one?

Author
Message
ICERGB
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 12th Jun 2003 16:20
Can someone give me an example of how meshes work?
"create mesh from object"
How can you save to a file and bring it back to turn it into a 3D object?
I haven't seen it really used at all.


Is there a way to make 3d objects static? or temporarily static? with colors intact?
Can I use a memblock or something?
I am hoping that maybe meshes will help accomplish this as the old static command used to work for DB1.13?
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 12th Jun 2003 17:51
I use it for much faster loading of objects and editing vertex data. I make a mesh from the object, then a memblock from the mesh.

Then I can

a) Save the memblock to a file then using the reverse sequence, load the object back in 5-10x faster (only works for non-animated objects)

b) Write / Read bytes to/from the memblock to change vertex data (eg: to make shiny objects, or make part of an object semi-transparent)

Static objects do not exist in DBP. However, the nodetree commands will make objects static and thereby improve speed.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
Mentor
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 12th Jun 2003 18:07
meshes save you having to load 90 trees from disk when they are all the same, eg:

Load object "tree.x",1
make mesh from object 1,1
delete object 1
for i=1 to 90
make object i,1,treetexture
next i

where treetexture was the bmp used as the texture for the original model, most games seem to use many different models instead of the same model over and over, as for static objects, they have been left out of Pro, so you would have to make the objects some other way, at some point they have to be made into objects inside the game to to become visible, not sure how you could do that with memblocks though, without getting the same performance hit you get with objects.

Mentor.

Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 12th Jun 2003 18:14


you can do it many other ways but a very basic example

Within the Epic battle of the fates the Shadow and the Angel will meet. With it will harbinger the very fight of good vs evil!
ICERGB
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 13th Jun 2003 05:19
Nice!
Thank You;
Rob K, Mentor, Raven...

I can't seem to find a nodetree command tho?

And any possiblility explaining how I can make a part of a object transparent?

Is it at all possible to UVmap only a part of a native DBpro 3d object?
The Big Babou
23
Years of Service
User Offline
Joined: 10th Feb 2003
Location: Cyberspace
Posted: 13th Jun 2003 12:38
the nodetree thingy comes with patch 5, i don't know when it'll be out.

Kevil made a very cool snippet for transparancy, it's here:
http://www.darkbasicpro.com/apollo/view.php?t=10190&b=6

why would one only uvmap a part of a model? i uvmap the whole model and texture it afterwards.
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 13th Jun 2003 16:05
"And any possiblility explaining how I can make a part of a object transparent?"

1) Look in the code forums for Kevil's Transparency / Opacity mapping demo

2) Make the texture black or use a PNG with alpha transparency (this only allows fully transparent or fully opaque though)

3) Using memblocks, the fourth byte of the vertex colour is vertex alpha. If you haven't played with memblocks before, it will be a bit of a learning curve.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
ICERGB
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 13th Jun 2003 16:32


Awesome!

Thats going to make a few questions pop to mind immediately.

I suppose that if I am going to begin to understand how this sphere is being mapped I will have to compare a saved mesh sphere to a saved mesh cube in a text editor...

At least most of the fancy stuff is in the functions.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th Jun 2003 16:37
Have a look at the code I've just posted in 'Joining Objects' in the Newcomers forum - You can use that to get an idea of how memblocks are layed out, and how to manipulate them.
ICERGB
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 13th Jun 2003 16:53 Edited at: 13th Jun 2003 17:18
My guess is that I would need a step by step tutorial on this one...
A book I would buy.

Just out of my grasp at this point.

"not a Mesh/3D guru by any means" <cough>
The Big Babou
23
Years of Service
User Offline
Joined: 10th Feb 2003
Location: Cyberspace
Posted: 13th Jun 2003 17:05 Edited at: 13th Jun 2003 17:05
well memblocks are a bit tricky

for the transparency, the functions do it.

settransparency(object,image,percentage as float)
object ... object to be transparent
image ... texture of the object
percentage ... a value of 0 makes the object unvisible, 100 will make it opaque

setopacitymappingon(object,image,opacitymap,percentage as float)
object ... object to be used
image ... texture of the object
opacitymap ... texture that specifies which areas shall be transparent/opaque/anything between them
percentage ... a value of 0 makes the object unvisible, 100 will make it opaque
ICERGB
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 13th Jun 2003 17:07
Ah now that (Joining Objects) is Sweet...

But I don't think I would have put that in the beginner's forum (or beginners instructional book) either.

I dare say usefull, but not very instructional...

But I will still try to find some reference in it... (Not doing very well so far.)
ICERGB
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 13th Jun 2003 17:12 Edited at: 13th Jun 2003 17:23
I was wondering how all those "sin"s come into play...

Only in setopacitymappingon

Thanks also, BigBabou and IanM!
The Big Babou
23
Years of Service
User Offline
Joined: 10th Feb 2003
Location: Cyberspace
Posted: 13th Jun 2003 17:15
i think he makes a opacitymap in realtime, but you can do it in your favourite paint program also. just load it and pass it to the function
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th Jun 2003 17:35
Well, the question *was* asked!

IMO, the question should have been raised in this forum.
ICERGB
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 13th Jun 2003 19:45 Edited at: 13th Jun 2003 19:49
Don't try to rotate the flag.

I got snaps and pops!

--------------------------------------

Is it possible to save several 3d objects as one object or one mesh?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 14th Jun 2003 03:10
The flag should be fine if you switch culling off for the object. The alternative is to have a second set of vertices facing the other way, and I couldn't be bothered to do that

When you say several objects, do you mean several *identical* objects? If so, then you can reuse the mesh data to create as many objects as you want.
ICERGB
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 14th Jun 2003 12:24 Edited at: 14th Jun 2003 12:27
Identical objects are no good unless they are static...
I have a grid set up with data statements and they use 64 boxes.

Boxes in a pyramid type shape...

I was hoping to either make them all static or save them off as one mesh and load them as one object.
Maybe I can import them into a 3d editor and reduce the vertixes first?
Because I think 64 boxes is just redundant...

When I say pops, I mean, the monitor popped several times and then the dreaded blue screen came up several times then automatically rebooted.

Login to post a reply

Server time is: 2026-07-20 09:33:05
Your offset time is: 2026-07-20 09:33:05