Jump to content

  • Log In with Google      Sign In   
  • Create Account


Budinga

Member Since 20 Jan 2008
Offline Last Active Jun 03 2014 01:45 PM
-----

Posts I've Made

In Topic: Problems Porting Eric Bruneton's Water to XNA

16 January 2013 - 01:30 PM

Ok a little update I managed to figure out a few things now the flat version I found quite simple to get working , but I am aiming for the spherical version and I am stuck on the code for the matrix generation if anybody can give me a little insite in to what im doing wrong. At the moment I am using this code, but I am sure it dosent work properly as I only get a broken up sphere , so is there something im doing wrong do I need to construct the matrix in a different way.

 

Vector3 ux, uy, uz, oo;
if (radius == 0)
{
// flat ocean
ux = Vector3.UnitX;
uy = Vector3.UnitY;
uz = Vector3.UnitZ;
oo = new Vector3(camtolocal.X, camtolocal.Y,0);
 
}
else
{
// spherical ocean
uz = Vector3.Normalize(camtolocal);// unit z vector of ocean frame, in local space
 
if (oldcamtolocal != Matrix.Identity)
{
 
 
ux = Vector3.Normalize(Vector3.Cross(new Vector3(oldcamtolocal.M21, oldcamtolocal.M22, oldcamtolocal.M23), uz));
 
 
 
 
}
else
{
ux = Vector3.Normalize(Vector3.Cross(Vector3.UnitZ, uz));
 
}
uy = Vector3.Cross(uz, ux);// unit y vector // negate this ??
oo = uz * radius; // origin of ocean frame, in local space
 
 
}
 
Matrix localtoocean = new Matrix(
ux.X, ux.Y, ux.Z, -Vector3.Dot(ux, oo),
uy.X, uy.Y, uy.Z, -Vector3.Dot(uy, oo),
uz.X, uz.Y, uz.Z, -Vector3.Dot(uz, oo),
0.0f, 0.0f, 0.0f, 1.0f);


In Topic: Problems Porting Eric Bruneton's Water to XNA

01 January 2013 - 02:02 PM

Ok I am getting some ware now on the flat plane ocean, just gotta work on the spherical one. Just wanted to ask some advice on one more thing. When I load the precomputed scattering textures any advice on how to do this in xna, ive used the io.file to load the raw data I have tried to load it single by single. Af far as I can see he uses a half float to store each pixel, how the heck do I load this in to xna.

P.S still don't have the vertex shader working100% thanx smasherprog at least I am now getting someware. :)

In Topic: Problems Porting Eric Bruneton's Water to XNA

01 January 2013 - 12:01 PM

Hi,

 

Thanx for your answer I gathered it was something like that, the main thing I need to ask is did you transpose your Matrix before you passed them to the shader or did you just pass them the same way as the example and just change the y and z components. I did actually try swapping the whole everything first and I got nothing so I had to start again.

 


In Topic: Best way to see if mouse clicked in a certain area

20 October 2012 - 02:15 PM

The simplest way to do it is to just check the mounse has clicked within the bounds of the rectangle.

example: This is just a psudo example.


if (mouse.leftclick)
{

if (mouse.x > rectangle.position.x && mouse.x < (rectangle.position.x+width))
{
	 if (mouse.y < rectangle.position.y && mouse.y < (rectangle.position.y + height))
	 {
		   do something when rectangle is cliked.		
	 }
}

}

 

If you mean what i think you mean about win32 to d3d you mean you need to compensate for the clientsize verses windows size have a look at this link.

[url="http://www.directxtutorial.com/Tutorial11/A-A/AA4.aspx"]http://www.directxtutorial.com/Tutorial11/A-A/AA4.aspx[/url]

In Topic: What are you working on?

17 July 2011 - 09:26 AM

I am currently working on a Planet renderer uses a geomipmaps for the terrain, and realtime atmospheric scattering, water and clouds are a bit crappy at the moment, but i am getting there i have just managed to get the fps from 20fps to max of 150fps so still heavy work in progress. But thought i mite post some screenshots. :)



Posted Image

PARTNERS