water plane effects?

Jan 20, 2012 at 12:34 PM
love the engine. im working on building a scene editor for the engine and i have ran into an issue with the water effects on the terrain. im sure its an error on my end but thought id ask just in case. the issue i run into is sizing the water. i can size the water and the physics box. but when i ruduce the size of the water plane and physics box the underwater effect seems to travel indefinately. what im trying to do for example. lets say you want to have a lake pond or poll on top of a hill and there are parts of the terrain below the water line it does not matter where you are in world space if your camera height is below the water level it applies the under water effect to the camera and any vertices below the elevation of the water plane has the below water effect. is it possible to scale the effect down with the plane and physics box? ive spent a bit of time on this issue and if i had hair i think i would be out of hair to pull out. a genle push in the right direction would be great. thanks in advance and once again great project and ill be following closely as it develops,
Coordinator
Jan 20, 2012 at 7:39 PM
Actually this sounds like a bug in the terrain shader, it is only taking into account the water elevation, but not the bounding area of the water plane. I can try and fix this in the upcoming version but that may be a few weeks. Basically in GraphicsSystem class when it retrieves water elevation it should retrieve the min and max corners of the water plane as well and then save those off a float3 parameters for the shader. Then in the terrain pixel shaders it would need to calculate if that pixel's X and Z world space position were in range of the water plane. Unfortunately those shaders are at their PS 2.0 instruction limit so they would need to have something like shoreline detection removed from them to do this.

Thanks for notifying me of the issue, I'll definitely mark it in the issues section on the codeplex site and try and get to it.

- Nic

On Jan 20, 2012, at 6:34 AM, "nemisis83" <notifications@codeplex.com> wrote:

From: nemisis83

love the engine. im working on building a scene editor for the engine and i have ran into an issue with the water effects on the terrain. im sure its an error on my end but thought id ask just in case. the issue i run into is sizing the water. i can size the water and the physics box. but when i ruduce the size of the water plane and physics box the underwater effect seems to travel indefinately. what im trying to do for example. lets say you want to have a lake pond or poll on top of a hill and there are parts of the terrain below the water line it does not matter where you are in world space if your camera height is below the water level it applies the under water effect to the camera and any vertices below the elevation of the water plane has the below water effect. is it possible to scale the effect down with the plane and physics box? ive spent a bit of time on this issue and if i had hair i think i would be out of hair to pull out. a genle push in the right direction would be great. thanks in advance and once again great project and ill be following closely as it develops,
Jan 20, 2012 at 10:16 PM
Thanks a lot. That's a big help. I thought I was going insane. I checked my code at least 100 times.
Coordinator
Jan 23, 2012 at 2:49 PM
Edited Jan 23, 2012 at 3:00 PM
nemisis83 wrote:
Thanks a lot. That's a big help. I thought I was going insane. I checked my code at least 100 times.

No problem. Here's is the issue tracking number for your problem: http://quickstartengine.codeplex.com/workitem/17303

After diving in and looking more at this problem, it's going to be a lot more work than I originally anticipated. I'm not much of a graphics programmer, and it is one of the few systems I did not create (originally, I've added much to it though). One big problem I would like to solve while fixing the one you brought up, is that the engine currently only supports a single plane of water loaded at once. I would like the engine to support multiple water planes, and would like the terrain shader to do less work if possible. Currently every chunk of terrain in the world checks each pixel to see if it underwater, I would like only the chunks that are actually touching a plane of water to do that calculation, this would increase the framerate quite a bit for terrain rendering on GPUs that are pixel-bound. Prioritizing this is difficult, as I have some other major plans for the engine, such as vegetation maps to allow for grass and trees, and a custom scripting language to make it easy to develop interactive content. What I really need to get a highly-skilled graphics programmer for this engine to concentrate on those kinds of thing, as my expertise is in gameplay and physics programming.

Jan 23, 2012 at 4:52 PM
Thanks for the update. Ill fart around with it and see what I can come up with. I am still learning the programming I just started self teaching myself about a year ago. I do have another unrelated question. As far as the terrain goes I have a ray that projects out from the cursor to ultamately be able to place objects at a location on the map where the cursor is pointing. The issue I am running into is trying to add a get location method to the terrain. I have read several tutorials on quadtrees and still have a hard time wraping my head around it. I think what I need to do is get a list od indices and check to see if the ray intersects a triangle made from those indices and calculate the distance out into a position. Is there a easy way you can think of to do this?
Coordinator
Jan 23, 2012 at 5:18 PM
nemisis83 wrote:
Thanks for the update. Ill fart around with it and see what I can come up with. I am still learning the programming I just started self teaching myself about a year ago. I do have another unrelated question. As far as the terrain goes I have a ray that projects out from the cursor to ultamately be able to place objects at a location on the map where the cursor is pointing. The issue I am running into is trying to add a get location method to the terrain. I have read several tutorials on quadtrees and still have a hard time wraping my head around it. I think what I need to do is get a list od indices and check to see if the ray intersects a triangle made from those indices and calculate the distance out into a position. Is there a easy way you can think of to do this?

I already have this implemented in the next release, I can probably do a small release, like v0.265, that includes this functionality. My method works on anything with physics, so you can theoretically place objects onto other objects, not just onto terrain.

Jan 23, 2012 at 7:52 PM
That would be awsome if you could do a change set. That would allow me to continue with my project at hand. And thanks for the quick reply.
Coordinator
Jan 24, 2012 at 12:57 AM
No problem, I can try and get something checked in by tomorrow night.

On Jan 23, 2012, at 1:52 PM, "nemisis83" <notifications@codeplex.com> wrote:

From: nemisis83

That would be awsome if you could do a change set. That would allow me to continue with my project at hand. And thanks for the quick reply.
Coordinator
Jan 24, 2012 at 4:31 AM
Edited Jan 24, 2012 at 4:32 AM

I've just uploaded v0.261, which supports picking. Documentation is located here: Picking Documentation

As I'm the only developer I'm currently not using source control, so I don't have a changeset with which you can patch. I really need to get going soon, as it makes upgrading difficult for existing users. There were quite a few cleanup changes in this version, so if you've made your own changes within the engine you may have issues trying to merge everything. If you just need the picking code itself I recommend looking in SampleScene.cs, within the RayCastForEntityReport() function, and you will need all of the messages and structures used by that function (minus the reflection code at the bottom, which is part of the demo, not picking).

If you have any questions about the picking implementation feel free to let me know.

Jan 24, 2012 at 12:25 PM
Thanks a lot. I will check it out when I get home tonight. If I had more exp in c# I would help you out with the development but still learning. Hope you do find some help. That is a lot for 1 guy to handle. Keep up the good work.
Coordinator
Jan 24, 2012 at 1:56 PM
Thanks, I could do a lot more if I didn't work 50-60 hour weeks. I'm only able to work on it a few hours per week. I'll do what I can.

On Jan 24, 2012, at 6:25 AM, "nemisis83" <notifications@codeplex.com> wrote:

From: nemisis83

Thanks a lot. I will check it out when I get home tonight. If I had more exp in c# I would help you out with the development but still learning. Hope you do find some help. That is a lot for 1 guy to handle. Keep up the good work.
Jan 24, 2012 at 2:38 PM
That's ok im right there with you. Still gotta be able to pay bills and take care of the family.