Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 May 2008
Online Last Active Today, 04:05 AM

Topics I've Started

directional shadow map problem

27 January 2016 - 09:28 AM



As shown on screen, there seems to be an oddity with the shadows. I'm using a directional shadow map, which means I render the shadow map from an orthographic camera. I also confirmed the cyan blocks are positioned and connected to the grey floor. Is this a known bug and are there ways to get around it?

Dll reload: adding local code causes buffer overflow?

27 September 2015 - 01:46 PM

Edit: Solved the problem. Didn't reload some of my functions. Please delete.

c++11 lambdas: best practices for 0 dynamic heap allocation?

26 June 2015 - 12:08 AM

I've been finding that using c++11 lambdas has some nice benefits, due to these facts:

1) The limitation of the lambda's scope where it can be used

2) Hence no need to declare/define another function in another scope, eliminating distractions.


I mainly use lambdas as inlined c-style function callbacks, example:

auto callback = [](void* userdata)


 //do something..




I also use lambdas as small repeatable functions within a loop and I have some concerns about the dynamic allocations when I capture local variables. I've heard that the larger the size of the local variables you capture the more likely it is to dynamically allocate(need a source on this if someone can provide), so keeping the captured variables as minimal as possible is -probably- good practice.

So, as a guide:

1) Capture as few variables as possible

2) If you need to capture variables, capture by reference if it reduces the memory footprint captured. Avoid capturing by value.

3) It might even be wise to substitute captured variables as input parameters to the lambda (example: instead of [captured_var](...), use [](..., captured_var_input) if it reduces the chance of a heap allocation.


Now, what are your experiences and best practices with lambdas? Anything wrong with my conclusions? I'd like to hear them.


Different types of meshes and how to structure them in code

28 February 2012 - 01:03 PM

Hi, I'm trying to design a class hierarchy that different types of meshes will use.
They all will share a base class cMesh, and different types will derive from them.

So far, I've heard of these kinds of meshes that are different from the normal onces:
Skinned mesh
Rigged meshes (does this count?)

What other subsystems are needed to say, get a skeleton mesh working? (physics rigid body dynamics?)
In the case of a skinned mesh, I've been told it blends between vertex weights, and so need an animation system.

Also, is it wise to integrate animation components into my mesh classes? Or should they be seperate?
Plus, would appreciate it if you guys can bring up some other kinds of meshes that might matter.


'Mixing' Shaders and code to shader organization

25 February 2012 - 02:14 AM

I've been exposed to shaders for a short stint, and have been exposed to a number of lighting techniques.
I have a couple of questions regarding shaders:
1) What are some kinds of techniques that can be integrated into existing shader techniques?
Example: I have a basic Per-pixel lighting shader up. Can I integrate shadows into the lighting equation with minimal effort?
How about deferred shading, HDR lighting, etc? Can all these be combined into one shader that is used for objects that need to be
lit up? Or are there some kinds of techniques that if 'you choose technique A, you forgo technique B'? (Would love it if you can give an
example here)

2) How costly can setting uniform variables per frame be? I'm thinking of supplying some constant variables(example: WorldViewProjectionMatrix) to all shaders so there's no need to write extra code to constantly supply that uniform variable.