Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 08 Apr 2011
Offline Last Active Yesterday, 11:21 PM

#5304167 Good Tutorials Or Libraries On Gpu Profiling (Within Game Engine)

Posted by on 05 August 2016 - 05:46 AM

If it is an option to use an external tool in conjunction with your engine I think RenderDoc (https://github.com/baldurk/renderdoc) besides being an awesome GPU debugging tool also exposes an API you can hook into your engine for this.


EDIT: more specifically see https://renderdoc.org/docs/in_application_api.html

#5303768 Gui Libraries?

Posted by on 03 August 2016 - 05:01 AM

I've looked around online and there seem to be plenty of GUI libs but there dosnt seem to be any real consensus on what is "a really good" game GUI lib. Wondering if you could recommend any that would integrate well with a game engine.



  • C++ only (no XML/CSS/HTML stuff)
  • Free
  • Good performance
  • Lightweight
  • Easy to integrate (not copius amount of code to setup a simple control)
  • Low amount of dependencies
  • Open source
  • All the usual UI controls (buttons, drop-down menues, text rendering, etc)
  • If possible, ability to provide custom rendering

Any recommendations?

#5283083 Cascaded Shadow Map problem: seam between cascade

Posted by on 24 March 2016 - 02:07 AM

Have you tried making the cascades overlap slightly?

#5253403 Game Development Laptop

Posted by on 22 September 2015 - 01:46 AM

Why are all "professional" / "corporate" marketed laptops dual-core processors? And expensive as hell for crappier hardware? Something like Asus Zenbook which is marketed more as a "gaming" laptop is both cheaper and outperforms many "professional" laptops...

#5252321 Tile-based deferred shading questions

Posted by on 15 September 2015 - 03:31 AM

I've been reading the following paper on tile-based deferred shading https://software.intel.com/sites/default/files/m/d/4/1/d/8/lauritzen_deferred_shading_siggraph_2010.pdf and the referenced paper http://s09.idav.ucdavis.edu/talks/04-JAndersson-ParallelFrostbite-Siggraph09.pdf and I naturally have some questions :)


  1. It dosn't mention anything about shadowmapping. I assume you would only batch lights together like this if they do not cast shadows? Otherwise you'd end up with alot of shadowmaps.
  2. I assume this is for point lights only. For determining visible light sources in each tile, do you use the depth to recompute view space position and then test against view space light radius? Is there a better way?
  3. Do you use a structured buffer for passing all lights constants and then a cbuffer with number of lights?
  4. How does blending work in this case when you output from compute shader? In my normal point light pass where I do one light at a time and output lighting from pixel shader the additive blending is automatically performed.



#5252135 Omni-Directional Soft Shadows

Posted by on 14 September 2015 - 01:13 AM

Whats your shadowmap resolution per face?


Also when rendering into the shadowmap for each face, what is your proj matrix zNear and do you use the lights max radius as zFar?


The aliasing when moving is called shimmering. Should be some good google hits. Higher resolution and tighter bounds helps but you can never fully negate the problem. I believe if you can make the camera move only in shadowmap pixel-sized increments it will help too,


I've never had any aliasing issues to warrant a CSM for point lights. Whats the radius of your point light?

#5250227 Write to a texture with a Compute Shader

Posted by on 02 September 2015 - 01:10 AM

Have you used http://cryengine.com/renderdoc ?


You can step through the shader code and inspect the texture in video memory before, during and after the Compute shader. 

#5248757 sRGB on diffuse textures or gbuffer color texture?

Posted by on 25 August 2015 - 07:42 AM



If you assume that linear->srgb and srgb->linear is done by dedicated circuits, and is therefore free, then it's not something to worry about smile.png
Mark source texture views, GBuffer render-target, GBuffer texture view, and backbuffer render-target as SRGB:
(Textures)-- sRGB->Linear --[To GBuffer Shader]-- Linear->sRGB --(GBuffer)-- sRGB->Linear --[Lighting shader]-- no change (Lighting buffer)-- no change --[Tonemap]-- Linear->sRGB (Backbuffer)
Mark source texture views and GBuffer render-target as Linear (even though they're not!), and mark GBuffer texture view, and backbuffer render-target as SRGB:
(Textures)-- no change --[To GBuffer Shader]-- no change --(GBuffer)-- sRGB->Linear --[Lighting shader]-- no change (Lighting buffer)-- no change --[Tonemap]-- Linear->sRGB (Backbuffer)


Awesome, that was exactly what I was looking for.


As long as it's guaranteed to be a free operation (maybe only older cards dont have this feature? or newer but cheaper?) the first option then seems more clearer / less deceptive.

#5247393 Quaternions for FPS Camera?

Posted by on 18 August 2015 - 08:39 AM



Orientation returns a Matrix (x,y,z,w), which is two Quaternions multiplied together.


Yes; it takes the resulting quaternion and converts it to a rotation matrix.




 I'm guessing the * has been overloaded to support multiplying Quaternions?






The second part is a little difficult to understand. I can't find a resource to define what the translate method takes in and returns


It applies a translation component (the cameras position vector, mTranslation) to the input matrix (identity matrix in this case) and returns the result.

See GLM docs http://glm.g-truc.net/0.9.2/api/a00245.html#ga4683c446c8432476750ade56f2537397




Would mTranslation be the vector my camera was currently located at?



#5247359 Quaternions for FPS Camera?

Posted by on 18 August 2015 - 04:43 AM

Very simple using GLM (http://glm.g-truc.net/0.9.7/index.html)


Here's how to build a rotation matrix using Quaternions and vertical/horizontal angles only

// angles in radians
float mVerticalAngle;
float mHorizontalAngle;

glm::mat4 Camera::Orientation() const
    glm::quaternion rotation(glm::angleAxis(mVerticalAngle, glm::vec3(1.0f, 0.0f, 0.0f)));
    rotation = rotation * glm::angleAxis(mHorizontalAngle, glm::vec3(0.0f, 1.0f, 0.0f));

    return glm::toMat4(rotation);

Multiply this with the FPS cameras translation matrix and you have your view matrix.

glm::vec3 mTranslation;

glm::mat4 Camera::GetCameraTransform() const
    return Orientation() * glm::translate(glm::mat4(1.0f), -mTranslation);

#5245744 Which techniques should I use for lights & shadows in my game engine (SSA...

Posted by on 11 August 2015 - 08:45 AM

You can implement SSAO to have shadow when 2 surfaces are near and add shadow mapping on the point light to have shadow from your point light.

Bloom is the effect of blurring part of the image based on luminance. HDR is just to store the lighting result upper than 1.0 then you use a tone mapping to convert to LDR.

The luminance used for the bloom is based of the HDR image. You can add camera motion blur if you want to have movie effect.

To be more physically correct you can change your phong by Physically Based Rendering.

For the Antialiasing, FXAA is enough but suffer of the temporal aliasing.

After implementing all that then you will have better image result.


Do you know of any good sources for implementing PBR?


Also on the topic of SSAO I would suggest taking a look at http://graphics.cs.williams.edu/papers/SAOHPG12/

#5240445 Simulating the sun

Posted by on 15 July 2015 - 02:46 AM

Here's what I've tried right now:

void Sun::Update()
	if (!mIsMoving)

	const auto now = Clock::now();
	const auto timeDiff = now - mTimeStart;
	const float count = std::chrono::duration_cast<Intervall>(timeDiff).count();

	assert(mNightDayRatio <= 1.0f);
	if (count >= 0.5f + 0.5f * mNightDayRatio)
		mTimeStart = now;

	const float angle = count * glm::two_pi<float>() - glm::pi<float>();

	mDirLight.mLightDirection = Vec3(glm::cos(angle), glm::sin(angle), glm::sin(angle));

The issue is that at low or high angles the shadows gets elongated/really long. Is there an easy remedy for this? I want to keep it simple it dosn't have to be realistic, only believable.

#5236616 Uploading texture data to cubetexture

Posted by on 24 June 2015 - 02:26 PM

I'm puzzled why this isn't working.


I'm trying to add texture data to each of the cube textures faces. For some reason, only the first(+x) works. The MSDN documentation is quite sparse, but it looks like this should do the trick:

// mip-level 0 data
uint32_t sizeWidth = textureWidth * sizeof(uint8_t) * 4;
if (isCubeTexture)
	for (uint32_t index = 0; index < gCubemapNumTextures; ++index)
		const uint32_t subResourceID = D3D11CalcSubresource(0, index, 1);
		context->UpdateSubresource(mTexture, subResourceID, NULL, &textureData.at(sizeWidth * textureHeight * index), sizeWidth, 0);

When debugging and looking at the faces its all just black except the first face. So obivously I am doing somerhing wrong, how do you properly upload cubetexture data?


EDIT: R8G8B8A8 texture btw

#5226329 Visual Studio and HLSL compiling

Posted by on 29 April 2015 - 01:42 PM

I've got VS 2013 pro and currently have one hlsl source file for each pcf kernel, for example pcf2x2.hlsl, pcf3x3.hlsl, pcf5x5.hlsl, ...

VS compiles them automatically at build time, but it leads to some code redundancy and it unpleasant to work with. It would be much better to simply have one source file and recompile with different macros - but how does one make VS recompile the same file several times?

#5214680 NVIDIA NSight vs Visual Studio 2013 Graphics Debugger?

Posted by on 05 March 2015 - 03:02 AM

Try RenderDoc (http://cryengine.com/renderdoc). Of all the three, it is the one I keep going back to. Free, fast, awesome.