Jump to content

e.fortier

Member Since 21 Dec 2012
Offline Last Active Feb 24 2017 02:19 AM

Topics I've Started

Does the "discard" statement incur slowdown?

15 January 2017 - 03:17 AM

I've been reading in a number of articles that using the discard statement in a pixel shader is a bad idea. 

 

My question is this, if I already have an if() statement in my shader, will the addition of discard in the if block cause any slowdown? Or should I just set the alpha of that pixel to zero?

 

I'm using DX11 for displaying 2D graphics, so I do not do anything fancy and the shader I will be using the discard statement in will only be used to display text in a specific instance. My tests have shown no difference, but I'm afraid I might be missing something.

 

Thanks!


Instancing worth it for rendering text in a 2D game?

20 December 2016 - 02:21 AM

Hey guys,

 

I have a DX11 text rendering implementation where I have a bitmap with all the character glyphs that I use to build a list of quads with the position and UV of each glyph corresponding to the string I need to print. I then use one call to draw the text into a texture and can draw that texture wherever I need. Simple functions, simple shaders. I can also easily parse for special character, do linefeeds, limit the width for text boxes, change color, etc.

 

Today I sat down and decided to tackle the long overdue task of converting the rendering to use instancing, but it just hit me that it might not provide the great gains I previously thought it would. Most characters are of different sizes, so I would either have to handle resizing the geometry or maybe update the bitmap and then draw a fixed size quand and then reposition it based on the real width of the character. Or something else. This seems to break the K.I.S.S. principle.

 

Anyways, in the case where I do not issue more than 1 draw call to render the text, would there be any real benefits of using instancing to render text?

 

Thanks!


Alternatives for std::heap?

16 August 2016 - 01:16 PM

Hi all,

 

I am currently converting the JPS pathfinding code from C++ to Delphi and the code I'm converting uses the std::heap to manage the open node list.

 

Now, I never used the heap before and I was wondering what structure in Delphi I could use in its place or if there was a heap class for Delphi anyone had already done.

 

My knowledge of the STD is kinda abysmal as I usually never need to use it in my daily work, so any help on this would be met with untold gratitudes ;)

 

Thanks!


Highlighting objects in 2d game like in Baldur's Gate/Pillars of Eternity possible...

11 August 2016 - 11:24 AM

Hi all,

 

I was wondering if it is possible to create a HLSL shader to highlight objects like in baldur's gate or pillar of eternity, ie:

 

85299537.jpg

 

Or if this is done using a semi transparent texture on top of the object.

 

I'm not an expert with shaders, so I dont know if it is possible to detect edges like that.

 

Thanks for any help!

 


Multiple small shaders or larger shader with conditionals?

29 February 2016 - 01:34 PM

Hey all,

 

I was wondering if it was better to have my multiple smaller shaders, for example a shader for tiles without lighting, one for self-illumination, another for normal mapping and self-illumination, etc, or if it was fine to hale a larger one using IF/ELSE for different functionality.

 

I read that conditionals in shaders should be minimized due to their cost, but I wonder if it is better to hahe the IF/ELSE on the CPU side or if a few IFs will keep the shaders fast enough.

 

I'm only making a 2D tiled game.

 

Thanks for any input!