Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 21 Jun 2009
Offline Last Active Yesterday, 05:05 PM

Posts I've Made

In Topic: 3D World Editor - Suggestions and Ideas

22 September 2016 - 05:23 PM

I'm thinking of exporting all of the game objects and their components into a JSON file format.

JSON is one way to go. In fact, it's exactly what we are using at work for our research framework.

We chose JSON because it is human readable. We don't store actual models there - just model filenames with relevant data (position/rotation/scaling). We also store light source information, camera definitions and some other parameters.

The main drawback is that parsing text files is slow. If you plan to store actual model data there (i.e. vertices), I would advise you to come up with a binary format. It will make a huge difference in loading time when loading a scene with large amount of vertices.

In Topic: 3D World Editor - Suggestions and Ideas

22 September 2016 - 04:00 PM

How to implement the Redo and Undo algorithms ?

Think of the operations you do in terms of commands. You react to the UI by creating such commands, then dispatching them to a processor class which reacts to them. You keep a stack of all the commands you processed. Each command should encapsulate enough data to allow you to reverse it (for example, translation should store the origin, add object should store a reference to the added object, etc.).

Once you have that architecture in place, it's straighforward to implement undo and redo.




How to save the map, in what format and structure ?

Define map? And that really depends on your engine and the features you support.

I started to write an answer, but figured it's a topic on its own, so be more specific in what you want to export.




How to select faces, vertices, and transform them around ?


Hmmm.... Any particular reason you want to move faces around? That's what we have Maya for.

It's not difficult. Implement picking to detect which face/vertex was chosen, then update the corresponding vertices location in the vertex buffer.

Take a look here - http://ogldev.atspace.co.uk/www/tutorial29/tutorial29.html.

In Topic: Alpha Blend for monocolor (or min/max depth buffer)

12 September 2016 - 11:51 PM

Thanks N.I.B, that's a good idea using MRTs, but I feel like the overhead of render to separate RTs (write to 1 four channel pixel may be faster than write to 2 seperate one channel pixel? anybody) and alpha blend separate framebuffer may run slower than my original method (though I have to benchmark it...)


Well, you should benchmark it. But it terms of bandwidth, writing 4 16-bit values is double the bandwidth of writing 2 16-bit values. Same goes for fetching the data, you'll read 2 less floats (though the compiler might realize that you only use the red and alpha channel and optimize it).

Another option to reduce the bandwidth is to use blend-state write-mask and mask out the green and blue channel. That might reduce the bandwidth.


That's only helpful if you are bandwidth limited. If you are compute limited, than that probably doesn't worth the trouble.



But this definitely helps, and could you explain the populating min-max buffers a little bit? How does that works?

If you are referring to how the configure the pipeline, when you create the blend state you can set different blend operators for each render-target. MSDN has more info.

In Topic: Frame Time Swap Throttled

12 September 2016 - 11:39 PM

Is VSYNC on in your app?

My guess would be that this is the time DXGI waits until the next VSYNC. I can't think of another reason why D3D would throttle the swap operation.

In Topic: Alpha Blend for monocolor (or min/max depth buffer)

12 September 2016 - 11:32 PM

You can use multiple-render-targets:

- Bind 2 DXGI_FORMAT_R16_FLOAT render-targets.

- Bind a blend desc with (IndependentBlendEnable == true), where for one RT you use MAX and for the other RT you use MIN blend operator.

- In your shader output the same value to both render-targets.


Populating the min-max buffers is probably more efficient, since it consumes less bandwidth. It has the drawback that when you read from the buffers you need to do 2 sample operations, but that as well will consume less bandwidth than RGBA texture.