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.

Code Snippets / Create GIANT floor matrix effect and walls with ridiculously low polygon count

Author
Message
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 3rd Nov 2006 02:24 Edited at: 24th Nov 2006 22:30
It dawned on me how to make what seems like a GIGANTIC matrix. UV data describes how a texture is stretched across the faces of a 3d object. If the limits are between 0 and 1, the texture maps to the faces in percentages so that the object is covered completely by a single image more or less. If you increase the UV values past 1, it starts to tile... that is, the image repeats itself in portions or in whole.

So I ran with that premise and created a floor function that creates a PLAIN OBJECT that uses a tiled texture. What this means is you could create a PLAIN that is 200000 by 200000 units for example, and divide it into as many tiles as you want based on the texture scaling. So a 2000 x 2000 tiled plain would take up, let me do the calculations here... ok, carry the 1...

4 POLYGONS.

(note: for my wall function it's 24 polygons per wall)

Useful applications of these functions would be for floors, and walls mostly for interiors. The floor will be flat, though it can be rotated and therefore made into an incline. The walls could be used as walls or other square type objects. You could effectively create the interior floor plan of a whole building without taking a performance hit because the polys are so low.

I'm including 2 functions:

make_floor(obj,width#,height#,posx#,posy#,posz#,texture,across#,down#)
make_wall(obj,width#,height#,depth#,posx#,posy#,posz#,texture,across#,down#)


The parameter descriptions are as follows:

Obj = integer - Object number you want to create
Width# = float - x dimension
Height# = float - y dimension
Depth# = float - (Wall Only) z dimension
posx# = float - the x position of where to place the object
posy# = float - the y position of where to place the object
posz# = float - the z position of where to place the object
texture = integer - the image number to assign to object
across# = float - tile UV texture across by number
down# = float - tile UV texture down by number


The functions return the actual object number that was used to create the object. The functions check to make sure the object doesn't exist before a floor or wall is created.

I've included a little example. The textures stink because I just quickly whipped them up with the BOX command. With well made textures, everything looks pretty good!




Enjoy your day.
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 4th Nov 2006 15:04
this is not a matrix its a plain.
you cant handle plains like a matrix

[/center]
Currenty working for the Nvidia Game Dev Competition
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 4th Nov 2006 16:59
@Jack

For flat floors, ceiling, prairies, fields, grassy areas, slopes, water, ice, etc. this fits the bill. And I never said it was a matrix - thus the disclaimer in the title:

Quote: "Create GIANT floor matrix effect... "


And :

Quote: "...created a floor function that creates a PLAIN OBJECT that uses a tiled texture. What this means is you could create a PLAIN that is 200000 by 200000 units for example, and divide it into as many tiles as you want... "


Jack, you should try out the functions. Combine them with a few regular matrices to create mountains, and you can create MASSIVE landscapes that are both beyond the scale of any single matrix, and because they are PLAINS, reduce CPU processing overhead considerably.

Enjoy your day.
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 4th Nov 2006 18:10
All you are doing is creating a plain and using the built in SCALE OBJECT TEXTURE command to tile the texture. I would say that 99% of users here know of it and use it on a regular basis and is not as revolutionary as you make out.

Boo!
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 4th Nov 2006 18:28
I'm not sure what the goal of the criticism is. Perhaps if it was constructive or informative...

I've presented an idea, made a function for what I see as an easier means to use those tools, and gave a simple example with an explanation.

Enjoy your day.
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 4th Nov 2006 23:55 Edited at: 21st Feb 2007 02:26
I would never use a matrix.
Try to use some 3d models as a landscape. Its the best solution

And I think no one will have a flat landscape.

[/center]
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 5th Nov 2006 04:11
dont worry latch, everyone is at a different level, and thats where people forget they were at that level or thought at one time.


10 points for adding something constructive.
-10 for dismissing the guys attempt to produce something constructive.

you will find it happens a lot, but dont let it deter you from trying.

Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 5th Nov 2006 17:26
Maybe it's me, but I'm quite impressed by this. I didnt realise that you could make a texture repeat itself on a material like this, the effect that this has is it's possible to make really crisp textures, with less polygons when you use a repeating texture, which can be very useful for flat terrains/water etc.

Well done Latch, very useful

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 5th Nov 2006 22:30
@Jack
You're right, there are limits to how to use the plain, and using a good 3d model can be superior to using a matrix.

@indi
Thanks for that. What's useful to one person may not be useful to another.

@Kentaree
Thank you. I'm glad that you find it useful!

Enjoy your day.
Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 6th Nov 2006 14:30
It is useful, I've used that idea before in a DBC game I made. For some reason however, it seemed that the more I made it tile, the lower the framerate got. Maybe it was just my imagination..

Tempest - P2P UDP Multiplayer Plugin (DBP/DBCe)
Download the free version
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 6th Nov 2006 18:43
@Benjamin
That's a great observation; so I did a few checks and tests.

It seems that if you increase the texture tiling, WITHOUT increasing the dimensions of the PLAIN OBJECT, the frame rates go down, but if you increase the number of tiles AND the dimensions of the plain relative to each other, then the frame rate doesn't change to a point of hinderance.

I just made a floor at 2,000,000 x 1,000,000 plain dimensions tiled at 20,000 x 10,000 and the frame rate is around 344. That's a ratio of 100:1 = good amount of area per tile

At 20,000 x 10,000 plain dimensions tiled at 2,000 x 1,000 the frame rate is around 186. That's a ratio of 10:1 = not as good area per tile.

It seems squeezing more tiles into an unchanging area does cause a performance hit, but the hit can be alleviated by expanding the area (dimensions of the plain).

Enjoy your day.
RUCCUS
20
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 6th Nov 2006 21:16
Chances are thats because expanding the area of the plain decreases the total amount of polygons of the plain on screen at any time. The more polygons on screen, the bigger the framerate. The same goes for the amount of texture repeats on screen, frame rate goes up along with it.

I agree that any way people can help the community is good (as long as it helps more than damages), but I dont see a need for things pretty much the entire community could do (newcommers included if they read the help files a bit). Im not trying to be harsh, just explaining why you wont get many comments (atleast from different members), as chances are almost all of them can do it.

Along with that, as mentioned before the plain you've created isnt like a matrix much at all. The main purpose of a matrix is to provide simple terrain generation, meaning changing the position of the grid squares of the matrix to get a desired effect. Yes, this tiles an image across a plain just like a matrix does, but thats where the similarity ends, as you said its only 4 polygons (2 if its a 1 sided plain), so changing the vert positions of the plain wont do much.

A for effort though.
- RUC'

Your signature has been erased by a mod because it's larger than 600x120...
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 7th Nov 2006 17:52 Edited at: 7th Nov 2006 19:06
Quote: "The more polygons on screen, the bigger the framerate"

That would awsome! Or did you mean the bigger the framerate loss?

RUCCUS
20
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 8th Nov 2006 03:04
no havent you found the genious code that makes the game faster when theres more calculations to do?

Thanks Phealax, yeah I meant the lower the framerate .

Your signature has been erased by a mod because it's larger than 600x120...
Mr Kohlenstoff
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 17th Nov 2006 16:34
Hey, cool, thanks, I didn't even know the command.. but now I do.
Seems to be usefull.

Visit the DBPro - Speed up your game-Thread. http://forum.thegamecreators.com/?m=forum_view&t=88661&b=1
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 17th Nov 2006 21:04
@Mr. Kohlenstoff

Thanks!

Enjoy your day.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th Nov 2006 23:45
@RUCCUS

I almost forgot to thank you for the Frame Rate explanation.
Thanks!

Enjoy your day.
HZiM0rT4L
18
Years of Service
User Offline
Joined: 9th Sep 2006
Location: hnnnnnng
Posted: 23rd Nov 2006 21:02
when will people realise that you cant call a variable 'floor' - there is a command called floor that rounds down real numbers.

DB PRO RULES!
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 23rd Nov 2006 21:15
Not in DBC

Thanks for the heads up

Enjoy your day.
PAGAN_old
19
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 14th Dec 2006 02:59
turn up the view distance and see what hapens

dont hate people who rip you off,cheat and get away with it, learn from them
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 14th Dec 2006 18:03
I SET CAMERA RANGE from 3000 to 20000 and didn't notice anything. What should one be looking for?

Enjoy your day.
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 14th Dec 2006 18:30
It wouldnt matter as there arent any polys to cull...

Quote: "but I dont see a need for things pretty much the entire community could do"


You calling me a noob?

Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 14th Dec 2006 18:50
Quote: "You calling me a noob?"

You're a noob.

Tempest - P2P UDP Multiplayer Plugin (DBP/DBCe)
Download the free version
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 15th Dec 2006 00:26
Prrretty cool. I like how its low poly.


Quote: "You're a noob."

You sure?

-Mansoor Siddiquie

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 17th Dec 2006 16:43
@Xenocythe

Thanks!

Enjoy your day.
Lampton Worm
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 19th Dec 2006 16:52
Hi,

Pretty cool - but only if you don't need it dynamically lit. I guess a huge plain with dbp lights on it would look weird due to low poly/vertices?

Cheers
Crazy Ninja
19
Years of Service
User Offline
Joined: 27th Aug 2005
Location: Awesometon
Posted: 21st Dec 2006 15:47
Quote: ""You're a noob.""


no you're an idiot
http://forum.thegamecreators.com/?m=forum_view&t=95783&b=6

Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 24th Dec 2006 00:01 Edited at: 24th Dec 2006 00:01
Quote: "no you're an idiot"

Ahahaha.
No.

Tempest - P2P UDP Multiplayer Plugin (DBP/DBCe)
Download the free version
Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 12th Feb 2007 00:34
I don't mean any offense, just information - this isn't a very good method to use past very simple levels. Obviously stretching UV data past 1 works fine and 3d modelers have been using it since the dawn of... UV data, but the problems with using a single object for a large floor/terrain/whatever include :

-It won't work with fog because z-fog is vertex-based
-Obviously, you can't deform it at all
-It won't do specular lighting right
-If you compare speed, it's not much faster than rendering a higher poly object with equivalent texture data anyway; the video card is still chugging out the same level of texture information, which is what takes up the brunt of rendering.

Login to post a reply

Server time is: 2025-05-17 02:41:34
Your offset time is: 2025-05-17 02:41:34