Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 Jun 2007
Offline Last Active Mar 25 2016 01:18 AM

Topics I've Started

interpolate between multiple vectors

09 August 2014 - 11:39 AM

I was reading this article where they describe implementation of "light probes" in Unity game engine.

Quote from that article:

The useful property of spherical harmonics encoded probes is that a linear interpolation between two probes would just be a linear interpolation of their coefficients.


I don't know how to do this with more then 2 probes?

If i use distance from object to probe as a weight, how can i do this with (let say) 4 nearest probes?

How do i sum up this weighted vectors into one/final?


vs 2013 hlsl compiler output path

23 July 2014 - 12:58 PM

In my project settings i have set "Output directory" to "../Bin" folder, now i need to set output path for my shaders using HLSL Compiler as par of the build process, so i want my output shaders to be in "Bin/data/shaders/" folder but dont know what is the sintaks for this:




I have looked on MSDN help for Property Pages but cannot see example how should i do this.

Culling and objects management

20 July 2014 - 01:27 PM

Let say I have couple of thousands moving objects in my scene and i want to use frustum-sphere test to cull invisible ones.
Then in my code i have something like this:

struct BoundingSphere
   float x, y, z, radius;

struct ObjectsDetailPool
    BoundingSphere bs[MAX_OBJECTS];
    uint64_t visible[MAX_OBJECTS]; // 64 possible views
    DrawableThing dt[MAX_OBJECTS]; // mesh data

struct Object
    BoundingSphere* pbs;
    uint64_t* pvisible;
    DrawableThing* pdt;

vector<Object> vobjs;

... //here cull for all views

// draw

...//set shader...
for(auto& obj : vobjs)
    if(obj.pvisible ...) // this is bad?

...// repeat draw for each view

But lot of texts say this is bad because of branch mispredictions and what not, usually there is a lot of criticism but none of the solutions shown.

I dont understand how should i construct/manage this list then?
Should i partition the vector? So i swap-back invisible objects and store iterator where visible ends, but then again i have a branch because i need to check if it is visible.
Create a new vector and push_back only visible objects? But then again i have a branch because i need to check if it is visible.

Precompiled shaders

09 July 2014 - 06:34 AM

1. I am using VS 2013 express edition, i see that if i add any shader file to my project i can select HLSL compiler to use to build it, how should i load this shader afterwards? Do i read whole file in memory and pass that as first parameter to ID3D11Device::Create...Shader() method?


2. Any benefit to compile shaders on user machine (as installation process for example)?



Bone parent indices to linked list

06 July 2014 - 12:14 AM

I have an array of bone parent indices (where i marked root bone as -1). At some point i need to traverse thru all children of some arbitrary bone but this seems tough to do with this setup. I cannot come up with algorithm to create linked list like hierarchy from this , one like in DX9 animation system:

typedef struct D3DXFRAME {
D3DXFRAME* pFrameSibling;
D3DXFRAME* pFrameFirstChild;


where i can simply use recursion to achieve this.


Any pointers?