Page 1 of 1

Rendernet

Posted: Thu Mar 27, 2014 1:52 pm
by Imerion
Maybe I'm trying to run before I can walk here, but I tried to use a Rendernet to create a background which would react to player movements. I was thinking that if I saved the player coordinates I could check if any vertex where close to the player and then change it's z value, so the background would "budge" under the player. I didn't get this to work though. I was thinking of putting something along these lines :
if (PlayerX > this.Vertex.X-1) {
if (PlayerX < this.Vertex.X+1) {
if (PlayerY > this.Vertex.Y-1) {
if (PlayerY < this.Vertex.Y+1) {
this.Vertex.Z=-1;
}
}
}
}
in the RenderVertexExpression, but this got very weird.
Any pointers on how to handle rendernets if I want to accomplish something like this?

Posted: Thu Mar 27, 2014 2:13 pm
by Kjell
Hi Imerion,

Attached is a example :wink: Even though you generally want to use a shader for these kind of effects ( because of performance ).

NiGHTS into Dreams actually uses a similar technique for terrain deformation in the Soft Museum stage.

K

Posted: Sat Mar 29, 2014 6:52 pm
by Imerion
Thanks again Kjell, another excellent example!

Ah, I remember that level! Nights is a great game, really should pick it up and play through it again some day soon. ;)

Posted: Sat Mar 29, 2014 9:51 pm
by Imerion
Yep, works perfect in my game too!

I also tried to make it track multiple objects, but failed. I guess that would need another kind of approach.

Posted: Sat Mar 29, 2014 10:05 pm
by Kjell
Hi Imerion,
Imerion wrote:I also tried to make it track multiple objects, but failed. I guess that would need another kind of approach.
Attached is a example that uses multiple objects. Although you really want to use a shader at this point ..

K

Posted: Wed Apr 02, 2014 10:49 am
by Imerion
Modified it a bit and made it work with my game. Looks absolutely awesome! So happy with this! Thanks a lot!

Will look into shaders for this type of thing eventually, but decided I needed to learn that from the ground up using tutorials or so, in order to know exactly what those opengl calls do. ;)