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 / Deformable Movable Decal W/source and EXE

Author
Message
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 12th Nov 2010 09:14 Edited at: 13th Nov 2010 03:25
Just finished getting this right, it shows you how to do a decal that conforms to your terrain or level. I know this has been something that I haven't seen in alot of games here so I figured I'd contribute something to the community. Keep in mind that this needs alot of tweaking, such as storing the heights of the terrain on a grip and just snapping each vertex to that height instead of doing a collision each time, because doing so many collision, especially if you've got a plane with like 30 vertices, really lags up the system. But this is a start, and I'm sure it'll get the wheels going in your mind.
Enjoy, if you make improvements on this or have questions feel free to share.

Youtube Video:
http://www.youtube.com/watch?v=vvUQv2DSaQc


Attachments

Login to view attachments
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 12th Nov 2010 09:17
Okay, I just figured out how to get this running alot faster, heres the new main.cpp

Attachments

Login to view attachments
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 12th Nov 2010 21:47
Dang is it that uninteresting?
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 13th Nov 2010 00:44
I, for one, don't understand exactly what it's supposed to be doing. I see a grey-ish image with some polygon shape to the left side... Could you please explain it a bit better?

JTK
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 13th Nov 2010 01:50
I'm putting a video up on youtube to demonstrate. Basically with this you can have a plane with an image on it that deforms to the surface of any object. So you can do things like blood splatter on a terrain, without having intersection with the terrain.
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 13th Nov 2010 02:06
Quote: "you can have a plane with an image on it that deforms to the surface of any object"


Any object? So you could wrap the decal around the edges of let's say a cube? That would be quite nice.

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 13th Nov 2010 02:13
Yes, you would have to modify it a little bit, because this one only checks collisions on a vertical ray, so one a cube it would conform to it but you'd see some dramatic stretching of the image because of the 90 degree angle. If you limited how far up a vertex can be from another vertex you could stop the stretching from happening as several sets of vertexes would wrap around the 90 degree angle instead of it jumping up to the top. I hope that makes sense.
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 13th Nov 2010 03:11 Edited at: 13th Nov 2010 03:14
Quote: "you'd see some dramatic stretching of the image because of the 90 degree angle"


Yeah, that's what I thought of. But your solution with limiting the positions of the vertex sounds quite clever. I may try something like this too.

I had a go at your demo and it's working alright. But sometimes a few edges of the terrain are intersecting the decal faces, like they poke through it.

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 13th Nov 2010 03:24
Pretty much you just have to make the collision on a bigger radius or increase the resolution of the decal plane. I'm working on a solution for when terrain is intersecting the plane, but haven't come up with anything yet.
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 13th Nov 2010 03:29
A possible way to do it would be snapping the decal grids vertices to the vertices of the terrain, and change the decals UV coordinates accordingly to avoid ugly stretching. But that could be a tough thing to accomplish. Just an idea...

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 13th Nov 2010 03:36
That could protentially work, I thought about doing a ray casting procedure that would travel across the map and "bounce" across in small increments to find out where intersection would occur, it would be faster in the long run as the positions would be stored in an array.
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 13th Nov 2010 03:40
I don't quite get that. Do you mean you cast rays from each of the decals vertices to the neighboring ones to see if they collide with the terrain? Or cast them down vertically all over the terrain?

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.

Login to post a reply

Server time is: 2024-11-19 16:37:02
Your offset time is: 2024-11-19 16:37:02