Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

MegaPixel

Member Since 28 May 2010
Offline Last Active Apr 10 2013 04:12 AM
-----

Posts I've Made

In Topic: Switching between Camera Types (TrackBall -> First Person -> etc.)

17 January 2013 - 09:04 AM

There are several problems mentioned in the OP. My advices are:

 

1. You should stay away from using Euler angles if possible.

 

2. You should apply delta rotations and translations, but store the current placement as either a matrix or a pair of position vector and orientation quaternion.

 

3. You should not integrate too much responsibility into a single class. E.g. the camera class stores and grants read access to the placement of the camera as well as some simple manipulators (in extreme just a setter) for this placement, but it should not provide higher level control like a concept of 1st person and 3rd person camera. Instead, provide a basic CameraControl class and derive FPCameraControl and others from it.

 

4. When switching the active CameraControl, the next active control may need to alter the camera's placement to get it into a prescribed state. If you want to avoid sudden changes, then make a soft transition so that the current placement (i.e. those stored in the camera object, usually as left from the previous control) and the new required placement are interpolated over a short time, e.g. a second or so, before actually granting control to the following CameraControl object. Notice please that this can be integrated into the schema nicely: Define a TransitionalCameraControl class that is parametrized with the CameraControl that should become active. Let the former one do the interpolation (it asks the camera for the current placement and the given CameraControl for the required placement), and let it replace itself by the given CameraControl when done.

 

So that means that there is no way to switch from one camera control to another without interpolating between them ?

 

I thought it was possible to just accumulate in the right order (based on the current camera control type) to be consistent to one camera control or

 

another without sudden changes to show up.

 

Plus, currently I'm calculating my orientation like this and it works stable with no gimbal lock or numerical instabilities, but I do not understand why I should work with delta rotations instead of absolute angles (it works anyway).

 

Here is a code snippet:

 

//create orientation
QuatfFromAxisAngle(Vec3f(1.f,0.f,0.f),mPitch,&mRotX);
QuatfFromAxisAngle(Vec3f(0.f,1.f,0.f),mYaw,&mRotY);
QuatfFromAxisAngle(Vec3f(0.f,0.f,1.f),mRoll,&mRotZ);
QuatfMult(mRotX,mRotY,&mRotXY);
QuatfMult(mRotZ,mRotXY,&mOrientation);	

//normalize quaternion
QuatfNormalize(mOrientation,&mOrientation);
						
//now extract the orientation part of the view matrix
Mat44fInitFromQuaternion(mOrientation,&mViewMatrix.mat44f);


mViewMatrix.mat44f.v03 = -Vec3fDot(cameraPos,mRight);
mViewMatrix.mat44f.v13 = -Vec3fDot(cameraPos,mUp);
mViewMatrix.mat44f.v23 = -Vec3fDot(cameraPos,mForward);	

  It works smooth and perfect (I keep Roll == 0 all the way).

 Pitch, Yaw are just accumulated absoulte angles:

Pitch += dPitch; same for yaw

 

What I'm thinking is It possible to make just one class that gives just very bare bones operators to implement different camera behaviours without having to implement a class for every camera type ?

 

I saw some implementation showing something like:

 

rotateXCameraRelative

 

or rotateXWorldRelative blabla

 

which leads me to think they are just basic operators and there is no reference to first person or third or track ball ... and the idea is that a very specific combination of them can implement for example a first person behaviour or a trackball if you use a different combination of them.

 

I


In Topic: Packing Data Advice

28 September 2012 - 10:38 AM




I personally use one render target 16bit fp only as everything get modulated in one go:

return dffuseTerm*lightColor

diffuseTerm should be what you call in-scatter and light color is the rgb color of a given light.

I don't see why you have to use so many render target to store the computed lighting ... any reason for that ?

The problem, IMHO, is more relevant when you have to chose the number of gbuffers and their number of bit per channel as that is one thing that can influence your bandwidth.


MegaPixel, In-scatter is not diffuse lighting that's why I need more space :-)

http://en.wikipedia...._scattering....

my final color is:
fragment color = (diffuse fragment color*texture_color) + inscatter fragment color

regards

p.s.
>The problem, IMHO, is more relevant when you have to chose the number of gbuffers and their number of bit per channel as that is one thing that can influence your >bandwidth.

I agree but my problem is not about this (g-Buffer creation phase)...but in the next one: accumulation phase


Ohh you meant indirect lighting ?


No It's not.
Diffuse computation model the interaction between photons and surface
Scattered light model the interaction between photons and athmosphere or other medium. Here You can have 3 types of results in-scattered,out-scattered,absorbed.

The resulting effects is sort of volumetric effects.....


Ok so you are talking about sky light (the light reflected from the sky)? Light shafts ? ...

In Topic: Packing Data Advice

28 September 2012 - 01:50 AM


I personally use one render target 16bit fp only as everything get modulated in one go:

return dffuseTerm*lightColor

diffuseTerm should be what you call in-scatter and light color is the rgb color of a given light.

I don't see why you have to use so many render target to store the computed lighting ... any reason for that ?

The problem, IMHO, is more relevant when you have to chose the number of gbuffers and their number of bit per channel as that is one thing that can influence your bandwidth.


MegaPixel, In-scatter is not diffuse lighting that's why I need more space :-)

http://en.wikipedia...._scattering....

my final color is:
fragment color = (diffuse fragment color*texture_color) + inscatter fragment color

regards

p.s.
>The problem, IMHO, is more relevant when you have to chose the number of gbuffers and their number of bit per channel as that is one thing that can influence your >bandwidth.

I agree but my problem is not about this (g-Buffer creation phase)...but in the next one: accumulation phase


The accumulation phase is not a problem, just use another render target Posted Image. I personally use a different render target for my indirect lighting Posted Image ...

Again, the problem is normally the gbuffer phase, in a typical pipeline when you need to compose different results it's very normal to subdivide those in more passes, with each

pass it's own render target etc. and then compose them at the end.

In Topic: Packing Data Advice

28 September 2012 - 01:48 AM


I personally use one render target 16bit fp only as everything get modulated in one go:

return dffuseTerm*lightColor

diffuseTerm should be what you call in-scatter and light color is the rgb color of a given light.

I don't see why you have to use so many render target to store the computed lighting ... any reason for that ?

The problem, IMHO, is more relevant when you have to chose the number of gbuffers and their number of bit per channel as that is one thing that can influence your bandwidth.


MegaPixel, In-scatter is not diffuse lighting that's why I need more space :-)

http://en.wikipedia...._scattering....

my final color is:
fragment color = (diffuse fragment color*texture_color) + inscatter fragment color

regards

p.s.
>The problem, IMHO, is more relevant when you have to chose the number of gbuffers and their number of bit per channel as that is one thing that can influence your >bandwidth.

I agree but my problem is not about this (g-Buffer creation phase)...but in the next one: accumulation phase


Ohh you meant indirect lighting ?

In Topic: Packing Data Advice

27 September 2012 - 08:21 AM



Puting it into a 16 float is the hard problem. If you would have a 16 bit int you could use a 5:5:6 distribution. I don't know what your scatter value means and what value ranges they have, but there are other options.
One option is, that you can reconstruct one value from the other two (maybe using a mapping to transform the scatter value in a better representation). This way you only have two values, which could be saved as decimal number like "left_value + (right_value/MAX_RIGHT_VALUE)". This way you save the right value as fraction. Though you need to ensure that your base values are integer values and don't get too high.


He can do that trick with normals and store just xy (even though he has to be careful in which space they are as z can be negative or positive).

See http://aras-p.info/t...malStorage.html for several ways of compressing your normals in gbuffer.

But since he is talking about inscatter I would guess maybe he means the accumulated direct lighting and in that case we are in the context of manging hdr values.

So I would suggest if you are on PC just go for a 16bits frame buffer and use CIE to RGB conversion while tonemapping your luminance and then convert from CIE back to

RGB with the adjusted/tonemapped luminance. That will preserve your hue and saturation as it will allow you to work on just the luminance.

The need to store or compress values in smaller buffers is more relevant on consoles where the bandwidth problem is more present and, also, in the case in which you don't

support floating point blending (which is the case on PS3 if I don't remember wrong). A good approach is described in shaderx7, using LogLuv color space compression to

store HDR value in 8888 unsigned. The only disadvantage is that you can't blend in LogLuv space but there is a trick to do it and that is explained in that article.

Also you can couple that approach with a light prepass renderer scheme to reduce the bandwidth requested to your gbuffers even more, but at the cost of making two

geometry passes.


Let me clarify this: during the light accumulation phase of the deferred rendering pipeline I'm storing (for every light):

(RT1)R,G,B channels: diffuse light accumulation
(RT1)A channel: In-Scatter accumulation (monochromatic light scattering)

as described before maybe I'll create another RT and go to this scenario:

(RT1)R,G,B channels: diffuse light accumulation
(RT2)R,G,B: In-Scatter accumulation (colored lights)

Regards


I personally use one render target 16bit fp only as everything get modulated in one go:

return dffuseTerm*lightColor

diffuseTerm should be what you call in-scatter and light color is the rgb color of a given light.

I don't see why you have to use so many render target to store the computed lighting ... any reason for that ?

The problem, IMHO, is more relevant when you have to chose the number of gbuffers and their number of bit per channel as that is one thing that can influence your bandwidth.

PARTNERS