Jump to content

  • Log In with Google      Sign In   
  • Create Account


Gavin Williams

Member Since 04 Dec 2010
Offline Last Active Jul 22 2014 06:14 PM
*****

#5164924 Exporting non-indexed vertex data from 3DSMAx

Posted by Gavin Williams on 05 July 2014 - 01:33 PM

I think the answer is to write a custom exporter using MAXScript, which I'm trying to do now.




#5150015 limit on the how many bytes that can be passed across shaders

Posted by Gavin Williams on 27 April 2014 - 09:12 PM

Have a look here for the limits:

 

http://msdn.microsoft.com/en-us/library/windows/desktop/ff819065%28v=vs.85%29.aspx

 

So, the register limit looks to be 32 for shader inputs/outputs. You are creating 4x3x3+2 = 38 registers. So even with your a 'fix' for the alignment / padding, you will still be breaching the register limit. You will need another solution.

 

Edit: I agree with spazzarama below. I took a second look at it.




#5149750 ReportLiveObjects() isn't giving me enough information.

Posted by Gavin Williams on 26 April 2014 - 07:17 PM

Ok, so something I have never realized, is that a second (debug) device needs to be created in order to use reporting.

device3DDebug = new DeviceDebug(Device3D);

Then:

device3DDebug.ReportLiveDeviceObjects(ReportingLevel.Detail);

Gives the proper output. Thanks Mona2000

 

Edit: Some useful references

 

http://blogs.msdn.com/b/chuckw/archive/2012/11/30/direct3d-sdk-debug-layer-tricks.aspx

http://seanmiddleditch.com/journal/2014/02/direct3d-11-debug-api-tricks/




#5144921 change 1D addres to 2D addres

Posted by Gavin Williams on 07 April 2014 - 12:14 AM

Do you expect someone to have a faster method ? Do you have a performance issue with this code ?
 

If you are stressing over optimizations with code like this, I'll be surprised if you ever get anything done, really!

Just write your code, there is nothing wrong with your code unless you know there is something wrong. Especially this code, it's about as simple as it gets. There are a couple of ways to do it, but they boil down to the same thing, a few ops, which is totally not worth worrying about.

Come back when you have a function that's taking 10,000 ticks to complete, then we can talk about optimization.




#5127720 AMD's Mantle API

Posted by Gavin Williams on 31 January 2014 - 07:24 AM

Wow, the first I heard of Mantle was seeing an anouncement today that Battlefield 4 supports it as an alternative to DX with the 14.1 beta drivers. Here's a link to the BF4 page with performance comparisions ..

 

http://battlelog.battlefield.com/bf4/news/view/bf4-mantle-live/




#5117530 Collision problem

Posted by Gavin Williams on 17 December 2013 - 04:24 AM

Are you a machine ? You've collided with human beings in a public forum and banged square up against their strange habits of communicating in words.

 

Hello, what is your code and model number. We can exchange code in your native language. What will we make ? Physics, excellent. Do we understand one another ?




#5084178 Test for a range not being covered by a list of ranges.

Posted by Gavin Williams on 08 August 2013 - 11:19 AM

I just want to mention an immensely useful article by Eric Lippert http://blogs.msdn.com/b/ericlippert/archive/tags/shadowcasting/ which helped me get a grasp of the traditional way to compute visibility.




#5081615 Please help me get started

Posted by Gavin Williams on 29 July 2013 - 10:33 PM

Hi GDR,

 

I've sent through the solution, I've included a few details in the email, and removed a couple of things from the project that would cause a crash. If you have any question, just put them up here, as I don't check my email that often.

 

In regards to smooth animation and smooth frame-rate. It's almost impossible to get a consistent frame-rate, so the best strategy is to accept that every frame is going to last a different amount of time and write your physics to accommodate different frame times. As you'll see in my solution I use inter-op in the Clock class to access the performance counter. This gives me the highest accuracy reading of elapsed time over the frame. This is not the only way to measure frame-time but it's the way i do it. I then use that time to scale the velocity. So a short frame will result in a shorter movement over the frame while a longer frame will result in greater movement. So over many frames, you're objects do move smoothly.

 

Gavin




#5081355 Please help me get started

Posted by Gavin Williams on 28 July 2013 - 10:24 PM

Hi GDR.

 

Can i straighten out one point first, WPF can create smooth and continuous motion, no worries. And if all you are creating is a desktop application with not too complex graphics then WPF is perfect for you needs. I can provide you with a small WPF application that generates circles and allows you to drag and throw them around and does collision detection between the objects, although I didn't bother doing wall detection at the time but that's easy, and there are a couple of buttons in the app that don't work. It will certainly show you how to use a continuous time 'heartbeat' to create smooth motion/animation.

 

It sounds to me as though WPF would be more suitable to your needs.

 

Write an email to gavin_w3@yahoo.com.au with GDR in the subject line and I'll fix you up with the solution. Unfortunately when I checked it, it was updated to VS11 so you'll probably need to manually build it again.

 

I am personally using SharpDX at the moment with DirectX 11.1, I have also used SlimDX and XNA in the past. I would not recommend XNA, nor DirectX 9. Those technologies are in support mode and the newer DirectX versions have more features and are more future proof. There is very little reason to use those older technologies when DX 11 is widely available. You have to ask yourself why you need Direct X 9 support and why you would want to use that rather than a more fully featured and more modern library. Why are you considering XP support ? No one has XP anymore. Even if one or two people can pipe up and say 'I use XP' ... it's irrelevant. Just my 2c.




#5071355 Optimized deferred lighting....algorithm question

Posted by Gavin Williams on 19 June 2013 - 11:53 PM

I think you'll need to work out how to use additive blending. I can't really help you there, I haven't used XNA for a couple of years, Im using SlimDX and SharpDX these days. But if there is some restriction on using a blend state, then you'll have to get around that restriction. Because blending is definitely the method you need to use. Otherwise, how can you add one light to another ?

 

Edit : BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource  ..... just sets a texture to be used as both a rendertarget and shader resource, so both input and output,

so a texture can be written to and then used in the next pass as a source texture.




#5071342 Optimized deferred lighting....algorithm question

Posted by Gavin Williams on 19 June 2013 - 10:50 PM

When you say 'a rendertarget', line 2, what size is that rendertarget ?

 

And why do you then copy that rendertarget to a texture? It's a texture already!  ... you could use BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,

 

I don't understand what you mean by 'Im trying to clip my draw quads to the lights'. What draw quads do you mean ? And why use clipping ?

 

Each light will be added to your 'final light map' using additive blend, any light already added shouldn't be clipped out, it's in the light map already. I suspect you're doing too much work, particularly with the clipping. Look at why your system needs to clip to function. Your light geometry should match the size of the light, so no clipping is necessary.

 

It's the summed render surface size that will cost you (assuming draw calls aren't an issue), so any optimization will look at reducing that total draw size. So never render a fullscreen texture if you can do it with a light-size texture. Those oversize texture's add up. I'm sure that's why you're using clipping. Maybe you just need to disable clipping when adding your lights to your final light map.




#5031594 Please vote to support request for DirectX tools for C#

Posted by Gavin Williams on 12 February 2013 - 04:15 PM

Hi all,

 

I have put a request up on VisualStudio.UserVoice for Visual Studio to provide HLSL compilation, and other DirectX related features such as shader designer and model editor to C# projects in the same way that they are provided for C++ projects. Please help the vote along as it's really important that C# be treated equally with regards to DirectX development. These features could be easily provided to C#. And would make working with DirectX easier for C# developers.

 

Here is the link to the VisualStudio.UserVoice suggestion ..

 

Enable HLSL, DirectX and graphics development toolset for the C# language.

 

Visual Studio only provides hlsl compilation tools for C++ projects, while C# projects which also use hlsl are left without this facility. This is a glaring inconsistency in the tools provided to each language. C# is meant to be a first-class language yet the DirectX tools which are built in to Visual Studio are not equally provided to C#, this is an unnecessary and arbitrary limitation.

 

Developing DirectX applications with C# is becoming easier and there are now more tools than ever to work with this combination of technologies, including SlimDX and SharpDX, both fully capable managed DirectX frameworks (wrappers). Please provide C# developers with hlsl compilation, and for that matter, all the DirectX and graphics related tools that are provided to C++ developers, including the shader designer and the model editor. These features are equally usable by C#/DirectX developers as for C++/DirectX developers.

 

Thanks for any support.




#5024115 Normal Blending over Terrain Tile Edges

Posted by Gavin Williams on 21 January 2013 - 06:55 PM

Can you put up an image please.

 

The normals being in different draw calls shouldn't make any difference, if there is a hard edge, it's because you're normals are not co-directional, I think it's as simple as that. So your calculations are probably wrong.

 

You could check the vertex normals at a corner to test if they as you expect .. equal.




#5023763 Constructing / Loading resources asynchronously

Posted by Gavin Williams on 20 January 2013 - 10:49 PM

Hi,

 

I've started using async / await as I'm taking a look at WinRT. But Im having a terrible time getting to grips with async usage. Suddenly all of my objects have 3 'constructor' methods ...

 

 

public someModel(string modelAsText) // the constructor
 : base(modelAsText, VertexElementTypes.Position, VertexElementTypes.Normal, VertexElementTypes.Texcoord)
{
    // now often empty
}
 
public override void Initialize(DeviceManager devices) // called when graphics data needs to be loaded and bound to the device
{
    // setup any programmatic/fast data
    ....
    // setup any loadable/slow data
    LoadData(devices) // calls the async method
}
 
private async void LoadData(DeviceManager devices) // the async method to do the actual loading and binding
{
    ...
    IsReady = true; // flag indicating that all data is now loaded.
}

 

 

One thing that's starting to annoy me about async is that all my constructors are emptying. And all the construction code is having to be moved into the Initialize and async LoadData methods. I can't understand why a constructor can't be asynchronous. In my mind, it absolutely should be because like any object being constructed, it is immediately identfiable but isn't ready to be used until all its parts are in place. It seems to me that the language isn't designed correctly to handle this. I've read comments on the topic of async in constructors and I understand the reasoning .. early disposal causing leaks and object usage before its ready, but I would argue that the reasoning is only necessary because the model is flawed. That discussion isn't really helping me solve the problem, but I think it's a part of the topic.

 

Another problem I am seeing is that even though the file accesses are asynchronous, the awaits in LoadData cause the LoadData method to be synchronous (don't they ?) and therefore the thread has to wait anyway for LoadData to complete, so what's the point. The initialize method in this case is synchronous, so all the asyncronous code in the world can't make the drive load data any faster.

 

I'm really not sure about this, because when I run the app, the GUI does come up and the model pops into existence when it's loaded. So it actually seems to be doing what I want. And if i remove the IsReady flag I get a few frames where the states and shaders aren't set yet. So it seems to be running asynchronously !

 

Q : does the LoadData call create it's own thread and does execution immediately continue ( in this case, returning from the Initialize method immediately ) while the LoadData method contiues on it's way ?

 

I'd like to know what patterns people are using to initialize models and resources asynchronously.

 

Thanks for any help or advice.  Gavin




#5014616 What kind of optimization makes C++ faster than C#?

Posted by Gavin Williams on 27 December 2012 - 12:45 AM

It will be interesting to see how much the garbage collectors performance improves with asynchronous operation over the coming years. I've read some recent articles that suggest it is markedly improved.






PARTNERS