Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 25 Feb 2008
Offline Last Active Today, 03:15 AM

#5146167 Doubt with textures

Posted by Yourself on 10 April 2014 - 11:45 PM

Typically you would use submeshes. so a model (aka mesh), is actually an array of models ( frequently called submeshes).

a mesh is split into submeshes based on various strategies: artist defined, based on material/shader/texture/..., gameplay related reasons, ...

Do note that this (and pretty mutch any asset related operations), should be done offline.

#5145635 Deferred shading position reconstruction change

Posted by Yourself on 09 April 2014 - 06:01 AM

Thanks, I'll try it. smile.png

What does the rcp function actually do? Rounding, like floor / ceil in C?


rcp is the reciprocal ( 1 / x ).

note that in shaders this is often a fast approximation (so faster than actually doing 1.0 / x but less accurate).

#5126805 Increase texture reading speed

Posted by Yourself on 27 January 2014 - 03:40 PM

first off all, 144 tex lookups per pixel is a lot. a solution would be to simple use less ( find a balance between performance and visuals).


Try to make your textures smaller and/or slimmer.

fat textures (like your (R16G16B16A16) are slower so try to pack your data. 

Normals for example could be stored as X8Y8 and reconstruct Z inside the shader.


also look to the access patterns and filtering.

reduce filtering quality or try to use the Gather instruction if possible.

you could even refactor your renderer to make use of a compute shader where you can sample your textures into group-shared memory

#5126053 How to use VFACE in HLSL?

Posted by Yourself on 24 January 2014 - 03:05 AM

VFACE can be assigned to a parameter inside your shader function and the gpu will fill in the value on the fly.

something like this should work:

float4 PsMain( float vface : VFACE) : COLOR0
	if (vface < 0)
		return float4(1,0,0,1);
		return float4(0,1,0,1);

do note that on D3D10 (and up), this value is now a boolean and renamed to SV_IsFrontFace.

float4 MainPS( bool vf :  SV_IsFrontFace)  : SV_Target
    float4 output;
	if (vf)
		output.x = 1;
		output.y = 1;
	return output;

#5117280 Graduation project ideas

Posted by Yourself on 16 December 2013 - 04:07 AM

I'm with Kaptein: You can investigate a lot of other techniques (imho temporal reprojection has the best results atm) but in the end you will find out that SSAA (supersampling) is by far the best.


some ideas you could do (although not sure you can do them with unity)

* Volumetric related stuff (like you mentioned can be lighting but also shadows and participating media like fog)

* dynamic global illumination

* voxel related techniques (GI, shadows, reflections, ... )

* screen space decals

* layered material system

* GPU particles (either as vfx or for example fluid dynamics)

* occlusion culling (software based, portals, .. )

* reflections (screen space, glossy reflections, ... )

#5111230 PIX Crash

Posted by Yourself on 22 November 2013 - 01:10 AM

I use Intel GPA

The frame analyser works pretty good and looks and feels simular to pix.

#5089155 Rawinput x64 bit problem

Posted by Yourself on 26 August 2013 - 06:37 AM

UInt nSize = 40;
BYTE m_Buffer[40];

The size difference between 32bit and 64bit.

use something like:

uint8 buffer[sizeof(RAWINPUT)] = {};
uint32 size = sizeof(RAWINPUT);

#5082014 Shader debugger in DX9

Posted by Yourself on 31 July 2013 - 02:21 PM

You can look at Nvidia Nsight or Intel GPA

#5076320 Texture Filtering and Direct3D9 vs Direct3D11

Posted by Yourself on 09 July 2013 - 04:57 AM

Texture filtering is used to improve texture quality. The better the filtering, the better the visuals (but at a performance cost). 

You should pick-up a graphics programming book in order to understand why you need filtering and what it is for.


The reason it looks wrong in your case is because you probably didn't add borders in your atlas.

#5066232 Mutex creation in multithreaded library

Posted by Yourself on 30 May 2013 - 03:01 PM

If you target windows,  you could use DllMain

for other platform there are alternatives (see this for example)

#5065742 Need help making wet/rain shader

Posted by Yourself on 29 May 2013 - 01:51 AM

Sébastien Lagarde is writing some fantastic articles about this on his blog

#5065167 Question about redundant texture binds.

Posted by Yourself on 27 May 2013 - 12:55 AM

Doing stage-management on the context does increase performance.

in my framework it was almost 15% when it profiled it a couple of months ago (pre-alpha build of the renderer though).

#5063408 Moddable but not open source?

Posted by Yourself on 21 May 2013 - 12:33 AM

It depends what you want players to mod.

If you want them to create new levels for example, ship a level editor with it.

if you want players to modify abilities (for example movement speed of characters), give them a property editor (although I would combine this in the level editor).

If you want however players to have the ability to change everything and even make completly new games with it, you will have to provide a modding API.

#5063406 Smoothing the dges of a polygon

Posted by Yourself on 21 May 2013 - 12:27 AM

If you are working in 2D, I would use Catmull-Rom splines to draw the edges (google it).

if 3D, I would start by smoothing the normals (although that might improve the shading but not the geometry).

#5061721 Best way to render complex model

Posted by Yourself on 14 May 2013 - 02:30 AM

Do occlusion culling. Do not render/update the objects that are not visible.

For example the inside when you are on the outside of the ship (and vice versa) isn't visible so shouldn't be rendered/updated. 

Also, if you are on the inside, only render the decks/objects that you can actually see.

Google a bit for different occlusion culling algorithms.

There is no magic bullet for this so compaire different solutions and pick the best for your situation.


Also ask yourself if you really have to move everything at any time. There is a reason you cannot do that in most (AAA) games.