Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 16 Jan 2011
Offline Last Active Today, 07:18 AM

#5235558 Animation takes up too much memory

Posted by imoogiBG on 18 June 2015 - 03:21 PM

I have eliminated the redundant key frames (frames that have the same transform matrix as the preceding one) and have now reduced the size to 84 mb.

This isn't removing the redundant keyframes.It means that you have to remove frames that can be represented by using it's 2 neighbors(aka the derivative in moment t is the same as in t-1).

#5229495 HLSL and GLSL wraping again

Posted by imoogiBG on 17 May 2015 - 03:10 PM

I want to ask you guys, what is your approach on HLSL and GLSL wrapping. I have a solution that works, but its really ugly and really don't like it :



@vertex-attrib float3 $a_pos a_position
@vertex-attrib float2 $a_uv a_uv

@varying float2 $v_uv;

@uniform float4x4 g_projView;
@uniform float4x4 g_world;


    float4 worldPos = mul(g_world, float4($a_pos, 1.0));
    $vs_out = mul(g_projView,  worldPos);
    $v_uv = $a_uv;



@varying float2 $v_uv
@ps-out $color 0

@uniform texture2D tex0


    $color = sample2D(tex0, $v_uv);



This is later converted to HLSL/GLSL


Basically i use FCPP(really i don't recommend it) for marcos and pre-processing. and than some basic token matching + few macros. But all that $ @shader-main-begin are really awful... I really can't think of any other cleaner to basically wrap those two languages together.

What do you guys do?

#5228930 Want to create a cloud in 3d array

Posted by imoogiBG on 14 May 2015 - 03:43 AM

Guys I think he was asking about putting data into the array, rather than rendering it.

If thats the case. Stainless pointed out the right solution. Ray casting is the way to go.


What we do to convert geometry to voxels:

- Pick any wall from the grid (-X for example)
- Ray cast from the center of every cell that is on that wall against the geometry.

          The raycast function sholud be able to give you the hit position, and if hit is on a front or back facing triangle..

- Convert the hit points to index space of the grid.
- Fill up the cells that are between [front, back] faces.

If you want to generate those coluds dynamically I really cant give you a right suggestion. Maybe a perlin noise function will depend on the world space position of the cell, really don't know what is the best approch here.



I would try stating with a  sphere or an elipsoid and then distoting it with few random function.

#5228180 Particle Distortion Effect

Posted by imoogiBG on 09 May 2015 - 04:39 PM

The effect you're searching for is called "heat haze" and it's usually done with post processing.

#5227698 CapsLock, NumLock and pals in RawInput

Posted by imoogiBG on 07 May 2015 - 04:03 AM

I highy doubt that this is possible, becase the keyboard is the one that says if CAPS is on/off, they even have a LED indicator for this.

#5222214 [HLSL] Decreasing Shader Model from SM5 to SM2 (vs_5_0 to vs_4_0_level_9_3)

Posted by imoogiBG on 09 April 2015 - 06:16 AM

Well it depends on the number of unique instances that use skinning and the target platform.
If you have few models per fame that use skinning, then CPU skinning is a good choice.

Otherwise using a texture may sound a bit odd, but this techinque has been used in many games.


In most cases data shrinking isn't a good choce, because you're locking features form the artists.

Splitting mesh is a a tricky process, but if you can offload that work to an external tool what would save a lot a headaches.

#5222194 [HLSL] Decreasing Shader Model from SM5 to SM2 (vs_5_0 to vs_4_0_level_9_3)

Posted by imoogiBG on 09 April 2015 - 03:26 AM

old video cards (respectivy in old feature levels) had only 256 vector registers for uniforms (aka equal to the size of 256 float4 variables for example, or 64 mat4 matrices). if you want to reander with more bones, you defentaly can't fit them in those 256 registers the options are:

- try to shrink your matrices, use 3 registers for translation, scaling and rotation ,maybe scaling is always 1,1,1?

- CPU skinning.

- Split the mesh by bones in order to need less bones in the vertex shader.

- try to store matrices in a texture, and use texture lookups. Textures will be slower but with a lot of space for matrices.

#5221942 [HLSL] Decreasing Shader Model from SM5 to SM2 (vs_5_0 to vs_4_0_level_9_3)

Posted by imoogiBG on 07 April 2015 - 03:45 PM

I have one more question. If I decrease float4x4 Bones[1024] to float4x4 Bones[43], do I need to change something in the Input Layout for Vertex Shader? This is what I have now:

shader resources are not part form Input assembler, so there is no need to update the Input Layout, the layout only specifies how you re going to pass mesh vertices to the shader.


are you using D3D11_CREATE_DEVICE_DEBUG, there should be an error?


#5221860 [HLSL] Decreasing Shader Model from SM5 to SM2 (vs_5_0 to vs_4_0_level_9_3)

Posted by imoogiBG on 07 April 2015 - 09:36 AM

63 is still to much. you've got 256 vectors or 256 / 4 = 64 matrices in TOTAL.

#5218745 Cross platform GPU computation for real time ray tracing rendering engine!

Posted by imoogiBG on 24 March 2015 - 06:51 AM

i really don't think that there is a multiplatform solution.

At work we use both CUDA and opencl (via a lot of macros, restrictions ect.) but that currently won't work on consoles(as far as i know).

#5218630 SetTexture question

Posted by imoogiBG on 23 March 2015 - 04:18 PM


texPtr != lastSetTexPtr 
) // 
lastSetTexPtr is a static or class variable initialized to nullptr {    
Device->SetTexture( texPtr );    lastSetTexPtr = texPtr;    // 
or even Device->SetTexture( (lastSetTexPtr = texPtr) ); 

This is what I'm doing but there are 2 flaws.
if a texture is bound as a SRV, then later bind it again as RTV, the internal d3d state will be different form the cached one. Currently my workaround is to invalidate the bound SRVs so the next one will always bind the texture are RTV and vice-versa.

But basically every d3d/gl function I call, I call if via an interface, I call it ContextStateCache, this function changes only what is necessary.

what is your approach?

#5203369 DXMath simple operator, which one more effective?

Posted by imoogiBG on 10 January 2015 - 06:45 PM

The disassembly shown by Buckeye simply shows nothing.I don't know how he compiled or wrote the code for that disassembly.


for the 1st case his disassembly shows -> 00E9B6E3  call        DirectX::operator+ (0E1B029h)

Witch means that the code wasn't compiled with optimizations.


The second case we encounter 3 times adds (adds x component form 2 lanes)

Which is not what we want, by using SSE/SIMD we want 1 time addps(adds 4 floats from 2 lanes).


http://www.gamedev.net/topic/658216-sse-alignment-troubles/page-2 post -> "Posted 29 June 2014 - 09:42 PM"


BTW currently just don't think about sse and simd, it is really to much for a small difference(in the most cases). just use whatever you're comfortable with. Both are fast enough.


To answer your question : in the most cases the += thing should be faster because underneath it uses addps intrinsics(Which is the fastest possible way to add 4 pairs of floats).


PS: Always profile complete programs!









#5201485 DirectX 11 display RenderTarget bigger than Screen

Posted by imoogiBG on 03 January 2015 - 03:11 AM

Yes... my viewport was the problem. Thank You guys very much smile.png


 Don't worry, It happens all the time. Try using Visual Studio Graphics Debugger (or something else that can show you the full draw calls state) it is much easier to spot those errors.

#5201410 DirectX 11 display RenderTarget bigger than Screen

Posted by imoogiBG on 02 January 2015 - 05:04 PM

Maybe you forgot to call the ID3D11DeviceContext::RSSetViewports when you change the active render targets?



the uv-s should be the same no matter what.

#5192239 What to do if a coding project starts to feel too complex to handle?

Posted by imoogiBG on 11 November 2014 - 04:34 AM

offtopic :

Johnnie Walker 

Keep coding.