Jump to content

  • Log In with Google      Sign In   
  • Create Account

eppo

Member Since 14 Mar 2008
Offline Last Active Today, 03:48 AM

#5060240 Matrix palettes in vertex shader

Posted by on 08 May 2013 - 03:22 AM

As far as I'm aware, on D3D9 hardware, vs_3_0 texture fetches are your only option.

 

3.0 vertex texture look-ups aren't the fastest, so you'll have to try and see if performance becomes an issue.

 

ftp://download.nvidia.com/developer/Papers/2004/Vertex_Textures/Vertex_Textures.pdf




#5059681 laser/electric effect

Posted by on 06 May 2013 - 03:11 AM

Also called 'cylindrical billboards'.

 

They work similar to standard billboards, in that you want one specific vector of the billboard's orientation (say its y-axis) to always point in the direction of the camera. The difference is you also want the laser to keep pointing in the direction of its tangent line (say the z-axis). Because of this you only have the freedom to reorient the billboard around its z-axis. So towards whatever direction you re-orient the y-axis, it needs the be orthogonal in respect to the z-axis. You can do this by orthonormalizing the camera-vertex vector in respect to the tangent vector.

 

So the three vectors that form a billboard matrix' orthogonal base are:

 

y: normalize(cameraVertex - tangent * dot(tangent, cameraVertex))

z: tangent
x: cross(y, z)



#5056580 InputLayouts

Posted by on 25 April 2013 - 01:26 AM

I can't compile shaders online(because of hardware limitations), so i cannot generate dummy shader for each inputlayout... 

 

Most practical method is to validate the input layout against an actual shader that uses the input layout.

 

When binding an input layout together with a vertex shader, the layout needs to have (validated) element for all the VS' input elements (matching in position and order). It can have additional element used by other shaders, but it can never omit elements required by the shader.

 

For example, if you have an input layout that's validated against a shader that uses the input elements [POSITION, NORMAL, UV], the layout can be used to feed the following shader input structs: [POSITION, NORMAL, UV] [POSITION, NORMAL] [POSITION] [-]. (You'd validate such an input layout against the shader that has the largest span of input elements.)




#5056437 Translation within geometry shader

Posted by on 24 April 2013 - 01:54 PM

Shadow volume are extruded in the direction of the light vector in world space. Since this happens in the geometry shader, you'll have to do the view/projection transformation afterwards in the GS as well. The extruded volumes are transformed the same way as any other object in the scene.

 

Note that clipping and depth division takes place after the GS stage. The w-component has no meaning when passing data from the VS to GS. SV_Position is a required output of the geometry shader, not the vertex shader (when a GS is active).




#5056341 Translation within geometry shader

Posted by 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 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 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 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 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 on 31 March 2013 - 10:26 AM

This perhaps?

 

Refining an icosphere.




#5040755 Barycentric heightmap

Posted by 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 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 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 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 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?




PARTNERS