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.

Dark GDK / [GDK.NET] Limbs Mesh... I'm confused

Author
Message
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 9th Dec 2008 02:14
Im trying to rewrite some DBP code to .NET and need some help



I have made that to



But are not sure if I have forgot something (there are nothing to see on the screen)....

I want to learn to use vertex so I can build a terrain from data instead of loading objectfiles.

Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.
Mighty Batsonator
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Atmosoft Ltd. World Headquarters
Posted: 9th Dec 2008 02:33
I'm using the Triangle class to build my terrain one polygon at a time, forming squares from data much like a matrix.



I then have a two-dimensional array of these which are formed into my eventual matrix. The obvious advantage of triangles over the matrix is the fact they can be multitextured, and can use full object collision.

-- Coding your worst nightmare --
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 9th Dec 2008 13:07
Thanks.... can you give an example on how to use it? because with I try I cant see anything

Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.
Mighty Batsonator
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Atmosoft Ltd. World Headquarters
Posted: 9th Dec 2008 14:42
I certainly can.. Below is a CustomTerrain class that uses the code snippet I posted earlier.



Its constructor takes 3 parameters - number of squares x-wise, number of squares z-wise, and how long in pixels the side of each square is. I've provided a couple of sample functions, namely Plus and Minus, to demonstrate raising invididual vertices to create slopes, obviously some work is required to facilitate smoothing over larger terrains.

-- Coding your worst nightmare --
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 9th Dec 2008 14:58
I dont know what Im doing wrong... I make a new project and add these classes below and use

Dim ct as new CustomTerrain

but I dont see anything ?



Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.
Mighty Batsonator
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Atmosoft Ltd. World Headquarters
Posted: 9th Dec 2008 15:02
It could always be a camera issue... The positioning of the terrain starts at the origin 0,0,0 - which I see you've changed to 0,20,0. The camera could be facing away, or moving the height could have done something to the mesh normals... I'll implement your changes in my own copy and see what I can find. Bear with me on this one.

-- Coding your worst nightmare --
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 9th Dec 2008 15:03
I was also thinking about the camera... but I tried to move it but nothing happend...

Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.
Mighty Batsonator
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Atmosoft Ltd. World Headquarters
Posted: 9th Dec 2008 16:18
I've implemented your snippet, making sure to use your height of 20 and your square size of 10. Just to confirm, it works on my screen. I'm seeing a flat surface as seen below.



Could lighting be some kind of issue?

-- Coding your worst nightmare --
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 9th Dec 2008 23:07
There are some thing I do wrong..... I have been trying with Light but no result?....

Can you sent me the project? to niels.henriksen(at)netopcom.net so I can see if there are something i have forgot..

Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.
Mighty Batsonator
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Atmosoft Ltd. World Headquarters
Posted: 9th Dec 2008 23:17
I've attached the project to this post.

-- Coding your worst nightmare --

Attachments

Login to view attachments
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 10th Dec 2008 00:25
Thanks... and NOW im lost... it works.... but I will try to look through your code and see what i have done wrong

Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.
Mighty Batsonator
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Atmosoft Ltd. World Headquarters
Posted: 10th Dec 2008 09:52
It'd be interesting to hear what you make of it, actually, so I can tidy up the code and make it easier to use. Any bugs/errors/suggestions you may have, and such. If all goes well, I may wind up releasing this stuff as a plugin once its finished...

-- Coding your worst nightmare --
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 10th Dec 2008 10:01
My idea with the code (when i can make it work) is to make a terrain class that will activate zones when the player is walking to them and deactivate zone when the player is walking away.

I have been trying with objects as zones but that will be a lot of objects. I have also tried with matrix but thats not perfect to.

My "big" project right now is this terrain so I can make it as big as I want

Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.
Mighty Batsonator
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Atmosoft Ltd. World Headquarters
Posted: 10th Dec 2008 10:11
I plan to implement a tree-based rendering optimisation for this terrain, where only if a part of each "zone" is contained within the active camera's view frustum will it be rendered... I suppose in that respect it's slightly similar to binary space partitioning.

I plan to add it as a Constructor parameter, possibly like the hypothetical definition below:



For example, say you were to create a terrain of size 10,000 tiles by 10,000 tiles... Because each tile is made from Triangles, this would give you 6 vertices per Tile to render, resulting in 600,000,000 vertices to render. Ouch.

However, this is where the Tree culling comes into play. If you were to set it as 100, then every 100 x 100 Tiles would be split off into a separate renderable area of terrain, meaning at any one time you could be drawing as low as 60,000 vertices (multiply by the number of zones on screen). It's quite a reduction.

Now all I have to do is implement it

-- Coding your worst nightmare --
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 10th Dec 2008 10:49
Ok.... I didnt find the mistake but I converted your project to VB and now its working....

Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.
Mighty Batsonator
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Atmosoft Ltd. World Headquarters
Posted: 10th Dec 2008 13:33
Any suggestions on things to add in?

-- Coding your worst nightmare --
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 10th Dec 2008 13:40
Texture? I can see that there can be put texture on Triangle.

Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.
Mighty Batsonator
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Atmosoft Ltd. World Headquarters
Posted: 10th Dec 2008 13:49
I'm putting in a function to apply a texture across the entire grid, re-drawn to each tile so as to retain a satisfactory level of detail across larger areas. In the longer run I hope to have an overload for my Texture function that accepts 3 Images (low, medium, high), and will blend from low to medium to high as the terrain altitude increases. This could be used to fade, for example, from grass low down through rocks on a mountain, to snow at the pinnacle.

-- Coding your worst nightmare --

Login to post a reply

Server time is: 2024-11-25 07:36:48
Your offset time is: 2024-11-25 07:36:48