Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 14 Mar 2008
Online Last Active Today, 09:19 AM

#5056341 Translation within geometry shader

Posted by eppo on 24 April 2013 - 06:45 AM

You have to offset back-facing faces before transforming them into view space, so you'll need to do the both the view and projection multiplications in the GS.


Make sure the vertex shader only transforms vertices into world space: out.pos = mul(in.pos, matrixW).xyz;


Your geometry shader will have to do something similar to: out.pos = mul(float4(in.pos.xyz + lightExtrudeVector,1.0), matrixVP);

#5056285 Marching Cubes + Cubes....

Posted by eppo on 24 April 2013 - 12:41 AM

There's a technique called 'Dual Contouring' that extends upon the Marching Cubes algorithm. Aside from weight data on grid corners it also takes tangent vectors on the grid field into account, to allow for better reconstruction of edges.


The Procedural World blog has a post that explains it well.

#5056126 Screen Capture with DXGI

Posted by eppo on 23 April 2013 - 12:21 PM

Are you trying to capture the entire desktop, or only a single desktop window?


GetDisplaySurfaceData() only works in full screen mode. In windowed mode DXGI can blit to a shared surface managed by the desktop windows manager, but has no access to the entire screen buffer. DXGI 1.2 under Windows 8 adds access to the desktop via a Duplication API.


To create a screen dump: Link

To read the contents of a DXGI surface into sys mem, CopyResource() the backbuffer to a surface created with CPU_READ access. Then Map() the surface to read back the texture data.

#5056117 Change clockwise of a trianglelist

Posted by eppo on 23 April 2013 - 11:22 AM

You flip the ordering of the indices in the list: (0, 1, 2) -> (2, 1, 0).

#5055226 What to do with old per-vertex normals when doing normal mapping?

Posted by eppo on 20 April 2013 - 09:20 AM

It simply depends on whether you find the pre-computed normals usable or not. If they differ much from your own calculations or give poor lighting results you might feel like throwing them out. Tangent vectors can always be orthonormalized in respect to a normal vector.

#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;