Jump to content

  • Log In with Google      Sign In   
  • Create Account


We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.

Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Member Since 26 Feb 2009
Offline Last Active Today, 03:18 PM

Topics I've Started

How to apply Alpha Masks that move around and affect only specific objects (no fullscre...

19 August 2014 - 08:19 PM

Imagine a tiled 2D game where your character goes behind a wall (found a secret spot). Say I want to apply an alpha mask (a circle with faded borders) in the same position the player is, but only for the tiles/sprites hiding the secret spot, not for surrounding environment tiles (where the mask will overlap (due its big size) but not affect, cause theres notting behind then, its a solid wall)


check how the mask affects only specific tiles


Whats the best way to accomplish that?


#1# With stencil buffer Id need to render in lots of passes. (I suppose, I dont remember have ever used the stencil buffer before)

Render unaffected tiles + player;

Render the mask in the player position to the stencil buffer;

Render the tiles hiding the secret spot;


#2# With specific pixel shader:

Render unaffected tiles + player;

Render the tiles hiding the secret spot w/ a specific pixel shader, that also takes the mask and its screen position.


Which method is better?

The pixel shader method sounds better to me, but I dont know how/if it would work.

Id need to check if it overlap with the mask (comparing SV_Position witht the given mask screen position constant), and compute the equivalent uv on the mask..?


Computing the equivalent mask uv would be something like

mask uv: (mask_pos - SV_Position) / mask resolution?

What if the current pixel does not overlap (generating negative uvs, or greater than 1)? (if the mask is constrained to have black on the borders than clamping the computed uv to [0,1] would work I guess?)


Would #1 or #2 work?

Any better way of doing this?

dx12 - dynamically indexable resources -what exactly it means?

14 August 2014 - 02:07 PM

"In addition to the improved performance offered by descriptor heaps and tables, Direct3D 12 also allows resources to be dynamically indexed in shaders, providing unprecedented flexibility and unlocking new rendering techniques.  As an example, modern deferred rendering engines typically encode a material or object identifier of some kind to the intermediate g-buffer.  In Direct3D 11, these engines must be careful to avoid using too many materials, as including too many in one g-buffer can significantly slow down the final render pass.  With dynamically indexable resources, a scene with a thousand materials can be finalized just as quickly as one with only ten."



Does this means we will be able to bind lots of textures to a shader and than based on a drawable material (cb variable) pick the correct texture (index to texture) ?


Say I have a 2d game and I managed to put all my images on only 3 texture atlas, can I bind the 3 textures and never worry about textures again, as my sprites material will have an index to texture, being able to draw everything w/ a single draw call.


Did I get it all wrong?

Memory overwrite after allocating 4k ints

02 March 2014 - 02:00 AM

After debugging some really weird behaviors, like vectors going from size 0 to negative values out of nowhere, I realized this was happening after allocating 4000 ints with new. I dont understand, 4k ints (~15KB) is not that huge, and even if it was, why its messing with my mem?



struct TileMap{

		int * pTileMap; // indexes on m_vTiles
		int mapW, mapH;
		float hSpacing, vSpacing;

		sprite::InstancedSprites m_tileInstSprites;
		sprite::InstancesVertexBuffer m_IVB;

		~TileMap(){ if(pTileMap) delete [] pTileMap; }
	std::vector<TileMap> m_vTileMaps;

This is the structure you see in the vid. 

Both InstancedSprites and  InstancesVertexBuffer hold vectors on its internals, those are getting screwed..that doesnt make any sense, theres a memory constrain Idont know about? Dx

Im hopping is something really stupid, but the vid pretty much shows Im not overwriting stuff myself right?

ubiart engine pretty impressive

17 January 2014 - 05:44 PM



The link is at a point in the vid that the guy seems to be able to distort the images at his will, and some filling thing (I really dont get whats happening there) happens.


After thinking about it for a while, I think theres a real time "puppet warping" thing going on.

Puppet warping is a tool in photoshop, it basically triangulates a image (ignoring 100% transparency) so you can apply pin points and work on it as a skelletal hierarchy:




You can see on theyr engine things distorts a bit, until it goes too much and then another image (the 90 degrees cliff) takes place.


How they got such level of automatization? they have an image for lots of possible angles? not to mention this is one "forest tileset".


And then the hole magically gets filled leaving absolutely none discontinuity..(probably due the warping again..I suppose?)


Theres a tiny bit of info on the blog:



"If you’re into the technical stuff, we use 2D patches to contort sections of the image with a level of complexity that can adapt to the potential needs of the final rendering and the target machine. This technique adapts remarkably well to this type of animation and gives excellent performances in a real-time context."


Not sure if the patchs are different from the photoshop puppet warp.. If its just a curve (the hell is a path) how it influences the pixels?


Any insights?

Fixed Step - Interpolating positions, trafo hierarchies and snapping to position

11 December 2013 - 01:08 PM

Say you have a fixed step game loop, and youre interpolating positions just like that "Fix your time step" article.


Now say you have a transform hierarchy (world transforms that are computed from parent transforms and local transforms).


What I do Is interpolate previous world with current world (when current world != render world ). Works like a charm.


So I keep local, world and previous world, the render world is separated, with the render stuff.


What do I do if I want to snap to a position, with no interpolation? I cant set previous world by hand, because I only mess with the local transform (what if the parent change?)  I cant even think on what Id need to do to achieve that..Its confuse.


What should I do?