Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Nov 2010
Offline Last Active Nov 19 2012 04:15 PM

#4970121 Independent clip() in Multiple Render Targets

Posted by on 16 August 2012 - 06:09 AM

If you're using a pixel shader, you can create another technique that doesn't use the clip funtion and use it for those RTs.

Rememeber that clip doesn't return anything for that pixel, nor does it write any information to the back buffer or depth buffer. On newer graphic cards it stops the execution entirely.

#4967385 How do I maintain a good quality real time rendering without textures?

Posted by on 08 August 2012 - 07:25 AM

To get a decent looking reder you're going to have to use textures at some point. That's the whole reason behind "pixel" shaders.

Why cant you create your own texture? Or download some? You can even purchase texture packs. Just google 3D texture packs or visit http://www.cgtextures.com/ for free ones. Just make sure your read the "terms of use" and "license".

#4963358 Dual monitors and full screen input issues

Posted by on 26 July 2012 - 10:28 AM

What is the refresh rate on both monitors? Have you tried turning off Aero in windows 7 (the see through glass around windows)?

Vsync blocks Present() until the next vertical refresh. With a slower monitor refresh rate (< app's frame rate) your CPU is running ahead of the GPU. DX buffers up to a max of 3 frames of graphic commands (triple buffering), over that would induce FR drops and input lag. Turning on the second monitor only increases this lag because the OS is having to vSync 2 desktops (copying back buffers to surfaces).

To my knowledge, there is no way DX can get the time that the refresh happens and even if you could, you'd waste a lot of cycles- looping and doing nothing.
Is there a specific reason you want to use vSync? What are you trying to accomplish?

If you have to use it then you'll have to process your mouse and keyboard input in another thread which can be rather tricky because of deadlocks and the main thread (where Present() is ) blocked by vSync.

In my experience, I never use vSync. I lock the frame rate in code, measuring the elapsed time between each frame and use that ‘elapsed time’ to calculate the speed of movements and animations. Since I never use vSync I'm only familiar with what the documentation says it does not how it actually functions with other objects / code / situations.


#4961673 Unusual frame rate boost

Posted by on 21 July 2012 - 09:17 AM

In my applications I force a frame-rate limit and measure the elapsed time to smooth movement and animations. Fluctuating frame rates (within reason) are not uncommon. Without seeing any code I can only assume.

If you really want to know what is going on I'd recomned you profile your code with PIX.

#4961666 Dual monitors and full screen input issues

Posted by on 21 July 2012 - 08:58 AM

To narrow down your problem I would remove everything from your render loop, then add functionality back one by one, testing for the lag. There is really only a couple of things that can be the problem:
  • Garbage collection (if the lag is random)
  • CPU is outrunning the GPU (consider a new thread for a message queue that can process the input)
  • Bad driver

In any event you should use PIX to profile your code and see where the delay is coming from.

I have 2 monitors and have never had this problem. When I ask DX for a list of adapters there are 2 adaptors returned with the same name and if I choose the second one the device creation fails so I use the default without issue. DX will give you the default adaptor.

It also might be helpful if you post more information about your rig, like your graphic card, monitors and OS info.

#4947669 showing the DirectX EULA

Posted by on 09 June 2012 - 09:28 AM

I think the MSDN docs are referring to when your game install has to install the DirectX runtime because it is not present on the end users machine. If the end user already has DirectX installed there is no need to display the EULA because they've already agreed to it when they installed DirectX.

To get 100% clarity I'd suggest contacting Microsoft directly.

#4946478 DirectX 9 repeating sprites

Posted by on 05 June 2012 - 09:38 AM

The only way I know of to get texture tiling with Sprites is to implement your own textured quad drawing, i.e. looping or resize (change) the texture.

#4938167 [dx9, XMesh] Modeling and Rendering (bilboard) tree

Posted by on 07 May 2012 - 01:42 PM

As for the format type, it depends on what your game engine's importer supports. Natively, DX 10 and lower versions support the X file format. However, DX11+ doesn't. There are 3rd party plug-ins for 3DS Max that will allow you to export in the X file format.

When modeling vegetation most large studios use SpeedTree. It's expensive and I don’t think there is a demo or any licensing for indies. Usually when I model a tree I start out with a cylinder and then extrude, move and scale till I get the trunk and branches the way I want them. I add the leaves with a separate material and my game engine imports this as a subset and allows me to tag them as transparent, thus setting the appropriate blending stage when rendering.

There are also several free (low cost) tree generators that let you quickly create trees and export them in the X file format. I think Tree[d] is a good one. Just make sure you read the license and usage terms carefully.

Good Luck!

#4937205 Texture replaced when rendered to

Posted by on 03 May 2012 - 02:39 PM

Off the top of my head:

You could be clearing the target before rendering the next iteration.
Your blending operations could be wrong.
If you're using shaders, the shader might not be updated with the new data on the next draw call.
Or there is an issue with your loop that draws.

Use PIX to debug so you can pin point where the issue is happening in code.

#4842196 Orientation trouble

Posted by on 29 July 2011 - 09:58 AM

Look at your World Transforms. If you want the objects to face a spacific object you'll need to handle that by setting up a new "LookatLH" Matrix to replace your current roataion transforms.

#4823598 Grayscale Image Transitions Using SlimDX

Posted by on 15 June 2011 - 08:02 AM

Can anybody please help me out in doing this

Pixel Shader files end in ".fx". I did a google search for wpf pixel shaders and returned over 200,000 results. Here's a link to the first tutorial who is doing the exact same thing as you.


DirectX - SlimDx - XNA, thery're all based off the same platform pretty much so the only different is the language used to access them and who is resonsible for memory clean up. In other words, you can take C++ directx code and easily turn it into XNA or SlimDX assembly. Just keep in mind that the XNA platform uses the right handed cordinate system.

Good luck!

#4820945 Grayscale Image Transitions Using SlimDX

Posted by on 08 June 2011 - 09:34 AM

How can I use my HLSL .fx File in my slimDx code

Check out the "Loading, Compiling and Creating Shaders" section...

#4820655 Grayscale Image Transitions Using SlimDX

Posted by on 07 June 2011 - 01:35 PM

Can you please post a little bit of the main working code. I will be grateful to you

Are you familiar with HLSL and how to set that up on the CPU side? If not, it's too much to go into in a thread post. If you do know how- then obtaining your greyscale would be easy:

Color.rgb = (Color.r+Color.g+Color.b)/3.0f;

#4797560 Shadow Mapping Blending with Multi-pass Render

Posted by on 12 April 2011 - 10:53 AM

Again, no help from this forum… not complaining, just saying. Am I on a black list or is my question not worthy or worded correctly?

Anyway, I solved my problem on my own. For anyone who is having the same/similar issue:

My rendering process uses multi-passes to render lighting- this means I’m using additive blending for each light. When I started to add shadow mapping I was rigging my light shader to also calculate the shadow. This left me with a decent shadow for the first light but after that each shadow was blended using the same blending algorithm used by my additional lights- making the shadow too light (barely visible) and not consistent with the first shadow. I also started noticing how limiting the coupling of lights and shadows were. To decouple them and solve my issue I first render the scene with ambient light only. Then I render my shadows in the next pass (for each light) using additive blending. Source blend = ZERO and Destination Blend = SOURCE COLOR. In my shadow rendering shader I returned white for non shadowed areas and black for shadowed areas. Then I render each light with Blend ONE for both Destination and Source. This is working well but there’s more tweaking that needs to be done (i.e. handing transparency for the shadow as well as billboards with transparency).

Hope this helps someone.


#4791827 [DX9} Cubic Shadow Mapping

Posted by on 29 March 2011 - 12:27 PM

I've figured this out on my own. For those of you struggeling with cubic shadow mapping, TiagoCosta's PS code does work but it's the basic building block. You'll have to massage the code to work with your existing engine/app. To keep my box from being completely encapsulated in a shadow, I added ObjectID's in the green channel of the texture and then checked the ID's when rendering the box normally. This gives me the flexability to mark an object as caster and/or receiver and also allows for objects to shadow each other.

I'm still having issues with jagged edges and trying to soften the shadows without increasing memory usage but it's a fine line you have to ballance.

I chose Shadow Mapping because of it's simplicity, low-CPU overhead and it's ability to handle trasnparency like tree's and billboards - something very difficult with shadow volumes. On the down side, shadow mapping is very hardware dependant - R32 texture format and cube texture for point lights - (that's 6 textures). The larger your textures, the better the shadow accuracy but at a cost.

Thanks to TiagoCosta for his help. I'll continue to watch this post in the event I could help someone else.