Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Member Since 14 Mar 2008
Offline Last Active Yesterday, 08:35 AM

#5048611 How to calculate polyhedra in realtime...

Posted by eppo on 31 March 2013 - 10:26 AM

This perhaps?


Refining an icosphere.

#5040755 Barycentric heightmap

Posted by eppo on 08 March 2013 - 04:42 AM

I assume the two triangles lie in a square grid-cell and are connected by a single edge?


If so, first check on which side of the connecting edge the point lies: dot(point - pointOnEdge, cross(float3(0, 1, 0), edge) > 0).

Then plug the x and y values into the overlapping triangle's plane equation. (a*x + b*y + c*z = d) => y = (a*x + c*z - d) / -b.

#5040498 hopeless at art, heres my image.

Posted by eppo on 07 March 2013 - 01:01 PM

They didn't literally say that it's hopeless, did they?


It looks rushed, but that gives the characters a nice way of blending with the background. Facial expressions on the characters aren't too bad, but especially there you need to add more detail. Also try to be more subtle with the burn and dodge tools. They're an easy way of adding more depth/contrast, but that's better achieved through proper lighting.


Like Ashaman said: keep practicing.

#5036704 'averaging out' the colour of a texture?

Posted by eppo on 26 February 2013 - 08:11 AM

You can use GIMP's tone curve editor to cut off values above a certain threshold.


Because the highlights make up all of the finer detail in the picture, simply blurring and then darkening it slightly should also work.

#5030350 Taking screenshot & saving to BMP file

Posted by eppo on 09 February 2013 - 06:04 AM

It's likely a pitch-offset error. Instead of manually writing the contents of a BMP you're probably better of using an existing image writer. For example, a WIC (Windows Imaging Component) object can be initialized directly using Map() data and write out to a large number of different file formats.

#5028975 Alpha Testing: I manage to "scorch" my edges

Posted by eppo on 05 February 2013 - 03:13 AM

Btw, I whited out the entire rgb layer - completely, meaning across borders - of the texture in the opening post. That should ensure, that the colors around the borders were the same.

When do you do this? In Photoshop or during texture load time? Many photo editors have the nasty habit of zeroing out RGB values for 0-alpha pixels when they export an image.

Have you checked the texture in PIX?

#5028755 Writing to a dynamic vertex buffer

Posted by eppo on 04 February 2013 - 01:34 PM

Mapping with WRITE_DISCARD invalidates the contents of the buffer, so you'll have to update the entire buffer as you do in the second method.
You're effectively given a new buffer, which avoids stalls when the GPU is still using the resource.

#5028292 Sprite won't change position

Posted by eppo on 03 February 2013 - 04:07 AM

Objects.push_back( object );


std::vector::push_back() adds a copy of 'object' at the end of the vector. LeftPaddle in WinMain is no longer the same object as stored in Objects[].


std::list<Object*> Objects;


...should work.

#5027857 Texture won't load and I get an unhandled exception

Posted by eppo on 01 February 2013 - 09:01 AM

There's a bug in the Graphics class.

DxManager getD3DManager() { return this -> D3DManager; }

This method returns a copy of the D3DManager object. Because it's a (temporary) copy, its destructor is called causing the D3D device to be released.

You should return a pointer or a reference to the manager:

DxManager &getD3DManager() { return this -> D3DManager; }

(+1 for posting clean/readable code)

#5027513 Texture won't load and I get an unhandled exception

Posted by eppo on 31 January 2013 - 04:53 AM

I had another look at your code, and there's a bug in the Object::setPosition() method. You are dereferencing a null-pointer, 'Object::position'.

You never create the actual vector (in Object's constructor): 'position = new D3DXVECTOR3'.


b.t.w. there's no reason why position should be placed on the heap: LPD3DXVECTOR3 > D3DXVECTOR3;

#5027173 Texture won't load and I get an unhandled exception

Posted by eppo on 30 January 2013 - 08:05 AM

For default usage, use '0' (which also happens to be the value of D3DPOOL_DEFAULT, but it's an unrelated constant).


What is the HRESULT of D3DXCreateTextureFromFileEx?

#5026777 Texture won't load and I get an unhandled exception

Posted by eppo on 29 January 2013 - 08:59 AM

You (incorrectly) pass a member of the D3DPOOL enumeration as the Usage argument to D3DXCreateTextureFromFileEx.
This function has a return value that could tell you a lot about what you could be doing wrong.

#5026768 Does anyone use Lightwave 3D?

Posted by eppo on 29 January 2013 - 08:47 AM

Yes, Lightwave has a tool for that. It's called the "Thicken" tool.

#5025725 Slerping the Kool Aid - Help!

Posted by eppo on 26 January 2013 - 04:53 AM

Quaternion.CreateFromAxisAngle(rotationAxis, rotationAngle) calculates the difference in orientation between forward and lookAt, but when slerping you treat is as an absolute orientation.

Quaternion qSlerp = Quaternion.Slerp(qStart, qEnd, (float)gameTime.ElapsedGameTime.Milliseconds / 1000f);

should be:

Quaternion qSlerp = Quaternion.Slerp(qStart, qStart * qEnd, (float)gameTime.ElapsedGameTime.Milliseconds / 1000f);

I don't know the exact implementation of these math functions, but you should check whether CreateFromAxisAngle() requires a normalized vector as input (which rotationAxis = Vector3.Cross(lookAtDirection, forward) likely isn't).

MathUtilities.GetUnsignedAngle() seems to throw out the sign of the angle, but in the code that follows you recalculate it:

Vector3 right = Vector3.Normalize(transformComponent.Transform.Right);

float rightDot = (float)Math.Round()...
if (rightDot > 0){ rotationAngle *= -1; }

So, you should either use GetSignedAngle() (if it exists) or use angle = acos(forwardDot).

#5025137 computer vision

Posted by eppo on 24 January 2013 - 11:06 AM

I think as an introduction '3D Math Primer for Graphics and Game Development' might suit.