Jump to content

  • Log In with Google      Sign In   
  • Create Account

csisy

Member Since 19 Oct 2009
Offline Last Active Apr 27 2016 01:15 AM

#5214665 UE4-like shaders from materials (theory)

Posted by csisy on 05 March 2015 - 01:09 AM

Hi,

 

I've just checked out the new UE4 (Unreal Eninge 4) and its material editor and I'm thinking how it works.

Is a new shader compiled for each material? If yes, isn't the lots of shader switches affecting the performance? How can it be optimized?

 

Edit:

According to this paper, the material is compiled into shader code.

 

This node graph specifies inputs (textures, constants), operations, and outputs, which are compiled into shader code




#5170326 Reconstructing Position From Depth Buffer

Posted by csisy on 30 July 2014 - 07:47 AM

I'm using linear depth rendered into a texture (I'm using 32 bit floating-point texture, so it's a little overhead reduction). From linear depth it's easy to calculate the world space position with the following steps:

- calculate an eye ray, which points from the eye position to the proper position on the far plane

- when you have this ray, you can simply calculate world space position by eyePosition + eyeRay * depth, if the depth is in [0, 1] range.

 

This method is the same as Styves mentioned in the post above. There are some modifications of this technique, when you use linear depth in range [0, far - near] or [near, far] or something like that, but the "algorithm" is the same.

 

However, the "basic" stored depth is exponential, so if you'd like to use that, there's a really simple (but not so cost-effective) method to do that:

- if you have a texcoord in range [0, 1], you have to convert it into [-1, 1] by "texcoord.xy * 2 - 1"

- you set the depth value to the z coordinate

- then apply a homogenous matrix transformation with the inverse of the view * projection

 

Something like (GLS - NOTE: I didn't test it, just write it here) :

// read depth at the coordinate
float depth = getDepthValue(texcoord);

// get screen-space position
vec4 pos;
pos.xy = texcoord * 2.0 - 1.0;
pos.z = depth;
pos.w = 1.0;

// get world-space position
pos = invViewProj * pos; // or pos * mat, depends on the matrix-representation
pos /= pos.w;

vec3 worldPos = pos.xyz;

Since you have to do this for each pixel, this method can be slower than the previous one.




#5160938 Skill/Spell effects

Posted by csisy on 16 June 2014 - 04:46 PM

Hi,

 

Well, I've tried to find some simlar topics, but I can't. Probably I can't search :D This topic was my best hit.

 

So I've just done my basic particle system: I have an emitter which has direction, start/end values (like color, speed, size, ...) and a delay time between emitting particles. However, I'm just wondering how the computer games make their "own effects" for different skills. I mean, I can't use particle system for every spells.

 

I'm playing with LoL and it has a lot of different skills. For example here is Katarina's abilities. These are not particles. Are they using simple meshes (some quads) with animated textures with alpha blending? How should I handle these kind of effects?

 

And another one: if I have to use meshes and/or particles, how should I manage the different abilities? Now I have a base class (called Ability) and the different skills are inherited from it. In these classes I can handle the different particle emitters and actions. Is it a "normal" system or is there any better?

 

Sorry if I missed something or it's a duplicated topic.

Could you please give me some advice?




#4953855 Self shadowing polygon seems

Posted by csisy on 29 June 2012 - 12:48 AM

Hi

How do you create the shadow map?

EDIT:
And well... you should use a "normal" shading, like phong shading, which will be smooth.


#4825004 Calling c++ dll from c#

Posted by csisy on 19 June 2011 - 03:25 AM

@MartinsM: Your solution is good for me :) Lots of kiss :D

I post the full code, if someone are interested in it.
[edited]

Of course, I'll write an class, which will manage this, but it's a pilot version :)

So thanks everyone for the help

EDIT:
I had some trouble with code blocks, so I uploaded the files
Attached File  cpp_in_csharp.zip   1.22KB   83 downloads



PARTNERS