Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 07 Oct 2007
Offline Last Active Sep 30 2015 11:27 AM

#5250628 Non-linear zoom for 2D

Posted by AliasBinman on 04 September 2015 - 05:12 PM

The following code will do what you want assuming you have a constant update tick.


float Size = 16.0f;


then in the update

const float RateDecay = 0.99f; 

Size = Size*RateDecay;


If you don't have a fixed timestep you can do the same using exponential function

size = size * log(dt * kConstant)

#5249003 HDR tonemapping without render-to-texture?

Posted by AliasBinman on 26 August 2015 - 09:40 AM

Also post processing effects such as DOF, Motion Blur and bloom look far better if they operate on the HDR data prior to tonemapping.

#5244996 Tinted bloom?

Posted by AliasBinman on 07 August 2015 - 12:07 PM

Looks like the bloom buffer is tapped 2 times with a centered radial UV shift and each tap is tinted with a purple and orange tint and added together.

#5236764 Imposter Transitioning to Mesh

Posted by AliasBinman on 25 June 2015 - 11:10 AM

I created a simple demo on this using WebGL. The blog post detailing what is happening isn't finished but in the mean time you can look at the demo and see what I am doing in the ModelWarpVS shader. 



#5233835 Roughness in a Reflection

Posted by AliasBinman on 09 June 2015 - 11:05 AM

This is the best blog that describes this irradiance convolution.




For a gentler introduction follow some of the references and in particular the AMD presentations on this.

#5233591 Difference between camera velocity & object velocity

Posted by AliasBinman on 08 June 2015 - 12:56 PM

The main difference is that camera motion blur can be done via the depth buffer and some static per frame constants where as object motion blur needs a velocity per pixel or at least some per pixel data needed to calculate it. If you are doing motion blur on skinned objects then this requires extra work and more bones in the VS or at least cache off the skinned data over at least one frame.


Ultimately its because of efficiency and ease of integration. 

#5231538 How to get started with shadertoy ?

Posted by AliasBinman on 28 May 2015 - 01:50 PM

Here are a few links. 

The first set are from iq who is the co-creator of shadertoy


http://iquilezles.org/www/index.htm (distance functions and others)




This is also a great resource (as well as its references at the bottom).




The great advantage of shadertoy is the near instant feedback loop from trying somethig to seeing it on screen.

#5231274 Imposter Transitioning to Mesh

Posted by AliasBinman on 27 May 2015 - 10:53 AM

I wrote an impostor based system for a sports game where we would draw up to 20,000 instances of the crowd. I would then swap in the 3D model when you got close such that the impostor texture would start to magnify. I managed to do this with no noticeable pop. 


I have a blog post half written on how I did this and will update this thread when I finish it. The secret sauce however is to differentiate between internal and external perspective with regard to the impostor meshes. By this I mean we rendered the models to the impostor texture with an ortho projection. The quads were then rendered into the world with a perspective projection. Then when drawing the 3D mesh I would do this same ortho in local space, perps in world space operation. This internal ortho projection was then lerped to a full persp projection as it then got closer to the camera. The downside is you get a weird rotation of the 3D model as it approaches the camera but its something that you have to look for.


Video of the crowd in action 

#5224925 GPU Ternary Operator

Posted by AliasBinman on 22 April 2015 - 03:56 PM

That optimization could potentially make things worse. This involves an indirect data look up which can be slower than simply a couple of predicated moves. 

#5222329 What to do when forward vector equals up vector

Posted by AliasBinman on 09 April 2015 - 05:30 PM

This is a good blog which may help you.



#5131093 Old school 3D engines

Posted by AliasBinman on 13 February 2014 - 12:56 PM

Have you read the Michael Abrash series of books. Its more than just graphics programming but still a great read.



#5121928 Filmic Tone Mapping Questions

Posted by AliasBinman on 07 January 2014 - 09:52 AM

This bit looks unneeded and should be removed


float exposure = key * L / avgL;


change it to 


float exposure = key  / avgL;


I don't see why you need the multiply by pixel luminance

#5060993 Blending Normal Maps

Posted by AliasBinman on 10 May 2013 - 10:15 PM


#5057308 Lighten/Darken a color

Posted by AliasBinman on 27 April 2013 - 01:27 PM

The simplest way is to do a lerp.


newcolor = lerp(color, vec3(1,1,1), x)   to Lighten

newcolor = lerp(color, vec3(0,0,0), x)   to Darken


In both cases x goes from 0 (no change) to 1 (full change)


if you don't know what a lerp is its a linear interpolate from 1 component to the next.


c = a + (b-a)*x

#5051881 Color correction - 3D LUT

Posted by AliasBinman on 10 April 2013 - 12:07 PM

You really need to ensure you remap the UV's to address from pixel centres to get the full range. This will stop the bleeding onto neighbour charts and give more exact results.

So if XY is RG and B is the chart index then do

UV.rg = (UV.rg * 15.0f/16.0f) + (0.5f/16.0f);
You may not need the (0.5f/16.0f) at the end depending on whether you need the half texel offset.

To filter across charts you'll need to do two taps and a lerp on the fractional distance between charts.