strange artifacts when modifying sea (making waves)

rebeccap

29-11-2010 05:49:56

I have modified Hydrax so I can control the sea from an external program over the network. I am actually using Hydrax as part of the visualisation engine for a high speed ship simulator.

It all works fine, ie I can modify the height of the sea, except I am getting some strange artifacts at the lower edge of the sea. The way I am modifying the height of the sea is by superimposing my controlled height map (which describes the shape of the sea at a point in time) with very small ripples (Perlin noise of low strength). I do this in the ProjectedGrid module in all the lines where mNoise->getValue is called. Here's an example:
Vertices[i].y = -mBasePlane.d + mNoise->getValue(RenderingCameraPos.x + Vertices[i].x, RenderingCameraPos.z + Vertices[i].z)*mOptions.Strength + mWaves->getWaveHeight(RenderingCameraPos.x + Vertices[i].x, RenderingCameraPos.z + Vertices[i].z);

mWaves is the class I've written to manage my "controlled waves".

Here's some pics of the artifacts. N.B. atm I am only controlling a small "field" of the sea, and at the moment the whole field is a constant height, so I am effectively just raising a portion of the sea. The problem is these blue "cutaways" I am getting at the bottom of the screen. I am not concerned with the discontinuities at the edge of the field which are a slightly lighter blue. I will smoothly interpolate my controlled sea with the non-controlled sea and the controlled field will be much larger, so this will not be a problem.






Any suggestions on how to get rid of these would be greatly appreciated!

SanguinarioJoe

29-11-2010 12:40:36

First for all, i don't know why do you want mesh your sea... Irregular sea numerical solution maybe?

I see your problem another time, but i don't remember the solution.

I think that you must move/resize your projected grid a little bit. The projected grid have the minimal dimension to could see entire by the camera, so, the edge near the camera is performed to stay at y=0 aprox, so if you move this points too much, the near to camera border (=end of sea) appears at the bottom of the screen.

Regards,
Jose Luis Cercós Pita.

rebeccap

01-12-2010 03:59:06

Hey Jose,

You are correct, I am doing a numerical solution on an irregular sea state.

I looked into how the projected grid works a little bit more and I think you are right. I need to resize the camera frustrum (view) a little bit so my very large displacements still fall within the camera frustrum when they reach max elevation.

Do you have any idea where the size of the camera frustrum is defined?

SanguinarioJoe

03-12-2010 14:56:08

Amazing! I'm Naval Engineer!

The camera in OGRE is an hierarched class of OGRE::Frustrum, so you can use all of this (whit the Camera pointer):

http://www.ogre3d.org/docs/api/html/classOgre_1_1Frustum.html

I don't know if I answered your question.

Regards,
Jose Luis Cercós Pita