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.

Newcomers DBPro Corner / Visual distances and Matrix to object

Author
Message
Twu Kai
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location:
Posted: 19th Aug 2006 23:29
Hi!

I've been working on something to do with a matrix, and it's very hard to visually find out what height each tile is... I need something a bit like fog, that will have a different shade for each distance. Actual fog isn't ideal as I want things behind the matrix to be shown, and the fog obliterates all other sign of the matrix if the height of it is too low. I would appreciate help on this.

Also, I really want to make a matrix into an object, as this would make it easy to save, and would be be more compatible... Thanks for your help in advance!

Felthenra-Cat. Hiss your way to freedom.
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 20th Aug 2006 00:28
Tile height= Get Matrix Height

Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 20th Aug 2006 00:57 Edited at: 20th Aug 2006 01:03
I think he means like this.



Twu Kai
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location:
Posted: 20th Aug 2006 14:44
Sorry, I forgot to say what language it is: It's DBPro

Hmm. Yes that is exactly what I mean, Daemon, thank you! One problem is that my matrix is already textured with different textures...!

Would having several spheres that have been scaled negatively, each of a different size, and ghost them? it might make the distance more noticeable?

Advice on the matrix to object thing would be nice, still.

Twu Kai- So fast you don't realise you're dead.
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 20th Aug 2006 23:02
yust replace this command with this instead so will not your texture be affected more then how much light that matrix tile recives instead off texturing it with differrent textures.

set matrix tile num,x,z,t

use this instead------------------------------------------

SET MATRIX NORMAL

This command will set the individual normal of a point within the matrix. The normal is a projected direction
away from the vertex position that instructs the matrix how to take light for that point. You can use
matrix normals to affect how the matrix is lit and at what strength. The matrix number and tile reference
values should be integer values. The normal values should be real numbers.

Syntax

SET MATRIX NORMAL Matrix Number, TileX, TileZ, NX, NY, NZ
Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 20th Aug 2006 23:11
Excellent suggestion. I am not very good with normals but this seems to work.



I know there is something which changes matrixes into objects. I think Lost in Thought made it. I don't know where it is though.

Twu Kai
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location:
Posted: 20th Aug 2006 23:51
Thanks very much, Cliff. I will try your code, Daemon, tomorrow, as I am on a different computer that doesn't have DBPro on it.

I have found the code Lost In Thought, although I don't know how it works, or which code I should copy out of the code he or she made. I tend to feel uncomfortable with my code if I don't know exactly how a part of it works.

Thanks all for your help.

Twu Kai- So fast you don't realise you're dead.
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 21st Aug 2006 00:30
no its not my code its the friendly chapp daemons code i only suggested an command change that he have done in the last source so use that one.
Twu Kai
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location:
Posted: 21st Aug 2006 18:55
Daemon, How exactly do I use that code, and which part? Because it does work very well...

Is there any way to make a matrix into a mesh? As that might be easier, and there is a command for saving a mesh as well.

Twu Kai- So fast you don't realise you're dead.
Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 21st Aug 2006 19:15 Edited at: 21st Aug 2006 20:03
If you already have "update matrix" in your loop call my update function there instead. If not, call my update function within your loop after player movement.

I can't really help you changing a matrix to an object/mesh since I haven't quite figured out object memblocks.

EDIT: Due to the conveniently timed appearance of the memblock mesh tutorial on these forums I have began learning mesh memblocks. So far these functions allow you to change a matrix into a mesh (then object) but it doesn't calculate normals yet.



Twu Kai
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location:
Posted: 21st Aug 2006 20:07 Edited at: 21st Aug 2006 20:10
Woo! Thank you very much, Daemon! May I use this code in my program? I will credit you.

I can take over the world now!

I will leave this here and report on what happens whith the matrix saving, as well.

Thank you all for the help!

EDIT: I have just seen your edit, Daemon, and will sift through it.

Twu Kai- So fast you don't realise you're dead.
Twu Kai
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location:
Posted: 21st Aug 2006 20:33
Sorry for the double post.

The saving and loading works fine. The only problem is that the texture doesn't load. It needs to load with it, as I am not sure how to make a skin that would fit over it in the same exact place as before?

Also, who made that mesh code? Was it you, Daemon, or Slayer93?

Twu Kai- So fast you don't realise you're dead.
Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 21st Aug 2006 22:09 Edited at: 21st Aug 2006 23:43
I wrote the matrix_to_mesh function but as you can see it is completely based on Slayer93's functions which he posted in his mesh memblock tutorial.

This puts textures on the mesh, apply's normals to the object, and shows off how much faster a program runs with objects compared to matrixes.



Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 21st Aug 2006 22:31
My matrix functions can be found here, though they need a serious update since DBP 6 came out as I can shorten and simplify the code alot. I just need to find time to do it:

http://forum.thegamecreators.com/?m=forum_view&t=58829&b=6

Even though I haven't had time to update the code yet, if you have any questions about how the code works ... you can email me and I'll find time to explain it. Just make sure you put DBP in the title or I may not see it.

I also made a matrix to object program for those who use matEdit and/or magicWorld which can be found here. Though it was made really more for DBC users I added the dbo export as well for DBP.

http://forum.thegamecreators.com/?m=forum_view&b=1&t=65024&p=0

Twu Kai
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location:
Posted: 22nd Aug 2006 19:35
Thank you, Lost in Thought. I have already got a way to save matrices, but would converting a matrix to an object then saving it include the texture?

Daemon, the mesh already has textures on it, so it wouldn't matter, I don't think.

Would it be more helpful if I showed what I was working on?

Twu Kai- So fast you don't realise you're dead.
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 22nd Aug 2006 23:42
Quote: "I have already got a way to save matrices, but would converting a matrix to an object then saving it include the texture?"


It only takes a second to test my codes. Best I remember, both the .x and .dbo saved textures to reload automatically.

Twu Kai
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location:
Posted: 23rd Aug 2006 13:19
I have started inserting your code into my program, Lost in Thought. The inly thing is, I dont know what values I should put for these: tilex, tilez, limbx, limbz, begtexnum, endtexnum. Help with this will be appreciated.

Twu Kai- So fast you don't realise you're dead.
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 24th Aug 2006 12:00 Edited at: 24th Aug 2006 12:00
As best I can remember ...



You can make some dummy textures to play with the numbers and seem what it does, or I can give you some with some example codes.

Twu Kai
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location:
Posted: 1st Sep 2006 11:57
I'm very sorry for not being on much, but I am replying now!

The begtexnum and endtexnum, is an image that the matrix seperates into more images to use as the texture a safe way to use these? IE: I have four textures in one image, I put the value 1 for betexnum, and the value 4 for endtexnum. Is that okay, or do I need to make four seperate textures identical to the four textures in the one image, and put the the image number 1 for begtexnum etc?

Twu Kai- So fast you don't realise you're dead.
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 1st Sep 2006 12:03
It works with 4 different images (though you can easily add a code to break your image up into the 4 images), see how I loaded the images in my example code?



And my beg and end texnum was image number 1 to image number 9

If you want to use your 1 image then just use your 1 image number for both. The reason I added this type of texturing was so you could load higher resolution images per each part.

Twu Kai
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location:
Posted: 2nd Sep 2006 19:30 Edited at: 2nd Sep 2006 23:38
Okay, I tried that. It didn't work.

I think I need to show you the code:


It's a matrix editor, that I am hoping to use for my games that use fairly big landscapes...

Hope you can find what is wrong!

BTW, here is the simple loading code I use...


Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 5th Sep 2006 01:29 Edited at: 5th Sep 2006 13:36
I note 3 problems with your code (a couple are caused by my code).

1) you are uaing vectors 1,2 and 3 in your code and mine creates and deletes after each use vectors 1,2, and 3 so you can change the vector numbers of either or.

2) this seems to be a bug in my code somewhere, but in a mtrix with 60 segments wide and deep the limb values can't be less than 4,4. It works with all values in my tests but I never went over 25 by 25 wide. I'll have a look at this when I get time.

3) when using the save object command you are using the .x extension. This will actually still save it as a dbo. so use the dbo extension or use this code, incorporated into yours, to save it as a limbed and textured .x



[edit] This one:

Quote: "2) this seems to be a bug in my code somewhere, but in a mtrix with 60 segments wide and deep the limb values can't be less than 4,4. It works with all values in my tests but I never went over 25 by 25 wide. I'll have a look at this when I get time."


Is caused by DBP not letting you have a memblock with a number of over 257 and it will create 400 with a 20 by 20 (60/3 by 60/3) (or 900 with your 1,4 numbers) limb design. I can work around this limitation if you really need it to work like this.

[edit2] Never mind on the memblock workaround. It will create more than 256 limbs which DBP hates. You should always use a limbx and limbz combination that will make less than 256 limbs. For a 60 by 60 matrix I would stick to around a 4,4 combination which will make 256 limbs with 32 polys per limb (or really use a 64 by 64 matrix instead with a combination of 8,8 for 64 limbs with 128 polys per limb which you can cull in around 1ms) and make your culling easy and fast.

Login to post a reply

Server time is: 2024-11-26 11:28:39
Your offset time is: 2024-11-26 11:28:39