• Content count

  • Joined

  • Last visited

Community Reputation

129 Neutral

About 2square

  • Rank
  1. Yes, I did use a float2 when using tex2D and a float4 when using tex2Dlod. My graphics card is a AMD 7970. I also tried it on a GTX 480. Still no luck.    Sorry for the delayed response, I was away for sometime.
  2. Hmm.. at first I thought that using tex2Dlod worked, but now I get this compile error instead.   error C1115: unable to find compatible overloaded function "SampleLevel(sampler2D, float2, float)"
  3.   Interesting. I knew you couldn't use tex2D in all the stages but didn't know the reason why. I believe I already tried tex2Dlod, but I'll give it another shot.    Thanks for replying.
  4. Hi,   This question pertains specifically to using NVidia Cg with DX11.   I'm trying to write a simple terrain tesselation shader that tesselates a quad patch and applies a heightmap in the domain shader for vertex displacent. I'm passing in the heightmap as a 2D texture and using the following line to sample the texture.   pos.z = tex2D(heightmapTexture, texUV).r;   But this doesn't compile and I get the following error.   error C1115: unable to find compatible overloaded function "Sample(sampler2D, float2)" Is this the correct syntax for sampling a texture in the domain shader, or is this not currently supported?   Thanks.
  5. Also look into PSSM (Parallel Split Shadow Maps). I've used it previously for an RTS game and it works quite well for large outdoor scenes.
  6. GPU and system RAM

    Thanks for the replies. I definitely understand the system a lot better now. I was basing my deductions off of old threads like this one [url="http://www.techpowerup.com/forums/showthread.php?t=2"]here[/url]. I believe things have changed quite a lot since then. Any detailed references to how the VRAM is addressed by the processor or how the graphics aperture works with the VRAM in current hardware will be greatly appreciated.
  7. GPU and system RAM

    Thanks for the detailed explanation. [quote][color=#1C2837][size=2]Yes, but only for the time required to copy the data between the two chunks, and only if this happens by mapping.[/size][/color][/quote] I'm not clear on this. I'm assuming that the two chunks you refer to are RAM and VRAM (mapped). If the RAM copy is discarded after copying over to the VRAM, how is the device restored automatically if it is lost?
  8. I've been trying to understand how a graphics card can use up system RAM and after reading up various resources online, I've come to understand that this can happen in the following 2 ways. I'm a little fuzzy after all the reading, and I wanted to make sure that I understand this correctly. Also, please let me know if I missed anything. 1) If you have a 32bit OS and have 4GB of system RAM installed, you will not be able to use all of the 4GB. Instead you can only address 4GB minus the amount of VRAM in your graphics card. This is because in a 32bit OS, you can address a maximum of 4GB (2^32 bytes) of memory. Since, the addresses of the local VRAM memory on graphics cards are memory mapped, they need to be within this 4GB limit. So, if a graphics card has 1GB of memory, we will only be able to use 3GB of system RAM even if we have 4GB installed. If the amount of RAM is less that 4GB, then this is not a problem because the VRAM will be mapped to the upper range of the 4GB limit which is not addressed by the system RAM. Also, this is not a problem for a 64bit OS since, the amount of addressable memory is not limited to 4GB (it can be 2^64 bytes theoretically). The graphics card is not actually 'using' the system RAM in this case, but in fact we're losing usable RAM because of address space limitations. 2) If render resources are put into the D3D managed pool, they they are basically duplicated in memory, i.e. they exist both in VRAM and a portion of the system RAM mapped by the graphics card for its own use called AGP memory. However, this is not the case if we use the default pool. In this case, the graphics card can use up system RAM regardless of the OS type. If however, we have a 32 bit OS with 4GB of RAM and are using the managed pool for our resources, then we have to take a double hit for the system memory. These are the two ways that a graphics card can 'eat into' system RAM. Please correct me if I'm wrong. Also, in the second case, how large a chunk is used for the AGP memory. Is it as large as the VRAM? Thanks is advance.
  9. See the section "Moving the Light in Texel-Sized Increments" in Common Techniques to Improve Shadow Depth Maps Hope this helps.
  10. You may also find this interesting Logarithmic Depth Buffer
  11. Quote:Original post by CodeBoyCjy HiZ is a coarse comparasion, while early-Z is for per pixel. Thanks for pointing it out. You're right. I mixed up Early-Z and Hi-Z.
  12. What you essentially need is a type of 'socket', which is nothing but a bone transform with an additional location and rotation offset. The 'socket' needs to be parented to a bone which will make sure that it animates with the model, and the location and rotation offsets give you the flexibility to place it exactly where you want (without adding the overhead of an extra bone). Your model will dictate which bone the socket should be parented to. Hope this helps.
  13. Early Z is a very coarse representation of the scene depth. It works on groups of fragments (8 pixels or so) so that they can be discarded before they are pixel-shaded. As such, you cannot solely rely on early z alone. Having said that I'm not sure if you can enable early Z without having regular/late Z. I think that that is not possible.
  14. Looks like your normals are inverted. Try making your normals face the opposite direction and see if that fixes it.
  15. Proper UINT32 colour arithmetic

    If you want to do the calculations yourself, it's pretty easy too float r, g, b, a; unsigned int packedColor = 0; packedColor = (packedColor | (unsigned int)r*255) << 8; packedColor = (packedColor | (unsigned int)g*255) << 8; packedColor = (packedColor | (unsigned int)b*255) << 8; packedColor = (packedColor | (unsigned int)a*255); You basically need to convert from float to UINT32 by multiplying by 255 (Note: you'll lose some precision due to rounding). After that you pack it into a UINT32 using some bitwise arithmetic.