Advanced Effects

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Here is the "Specular and Gloss" values encoded as R and G..
Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Raw Albedo..
Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Range Compressed Normals..
Image
Last edited by Vectrotek on Fri Feb 24, 2017 11:44 pm, edited 1 time in total.
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: Advanced Effects

Post by devsh »

By uncompressed, I mean binary dumps of the floating point Textures attached to Render Targets, especially important for the depth texture (you can grab them with glGetTextureSubImage)
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

SSAO.. Not really G-Buffer thing, but I multiply the output of the Deferred renderer by this..
(I'm trying to get it into the Deferred renderer as it also uses depth, to save time)
Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

By uncompressed, I mean binary dumps of the floating point Textures attached to Render Targets, especially important for the depth texture (you can grab them with glGetTextureSubImage)
Well.. I've never done that before, but when I do I'll send it.

Depth (24 bit)..
Image

I think you know a bit more about this than what I do, so, er..

Example of a binary dump?
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

If you mean a single image (G-Buffer) that was rendered to with some special pixel format big enough to hold the Normals and the Depth then
all I can say is that I'm not even close to that kind of advanced stuff! :oops:
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: Advanced Effects

Post by devsh »

You output depth to a separate image !?

But:
A) You waste fill-rate
B) You lose precision!
C) Whyyyyy?

You can retrieve the hidden depth image that irrlicht attaches to the Render Target Texture :D and just set it as a texture on your deferred shaders :) :) :)


You got Windows 7 64bit yet?
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

I now know a bit about the G Buffer, thanks, but I want to do it in DX too, so I'll look into it some time.
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

A new complication..

It looks like the Tangents and Binormals of a one time loaded mesh, which is the
base of some Instances, is not as unique to each instance as the set of normals are!!

What I mean is that each instance of this mesh has its very own normals
while the Tangents and Binormals looks like they are limited to one set.

Question..
Does Irrlicht share this one set of Tangents and Binormals between multiple instances of a given Skinned meshes?!?!

Here you can see how a "Tangent Update" for ALL Skinned meshes is valid for only one instance..
Image
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: Advanced Effects

Post by devsh »

Irrlicht's tangents on skinned meshes are basically broken
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Advanced Effects

Post by Mel »

You have to transform the tangents and bitangents within the shader for them to point to the proper place, the same as you would do with the normal. glNormalMatrix should do it (or the [transposed] of the inverse model*view matrix if i recall correctly...) The thing is that the instances need their own model matrix to transform properly the tangent space

http://stackoverflow.com/questions/2107 ... mal-matrix
You can retrieve the hidden depth image that irrlicht attaches to the Render Target Texture :D and just set it as a texture on your deferred shaders :) :) :)
I can already do this in Vulkan! hue hue hue... actually... if you can't figure how to do it, you're pretty much lost in there D: D: D: D: Does Irrlicht use 32f+8s or 24d+8s for the depth/stencil, btw :? ?
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Oh S#!..
Image

But wait.. All is not lost.. Can't one just create an array of Tangents and Binormals for each skinned
mesh "Instance" and update them if any point of a specific skinned mesh's Bounding Box is within the view frustum?
I haven't tried cloning meshes yet, but..

The plot thickens..
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Houston, we have a problem..

The situation is like this..

We load a geometry file, say a skinned "*.x" of a cool little character.
We now create a second "Instance" of this "Object" as it was loaded.
Reasonable request? Yes, because we want, say a lot of animated characters
but from the same 3D file as it exists in our data directory. One File, many Instances.

Irrlicht does this gracefully and seemingly in total "Deep Copy" fashion. Great!
Even the Materials of these Instances are "Unique" in that you may assign an
image to a given material of one Instance and another image to the same material of
ANOTHER Instance. This proved to me that I did successfully create an instance of a
loaded dataset/3D Object. The one instance has Image A attached to Material A and
the other Instance has Image B attached to it's Material A..
Even the vertices must now be unique because I animate them at different speeds.
With me? I rendered a "only normals" version of the scene and the Normals are ALSO UNIQUE!

O.K.
Now that I have some form of Deferred rendering that actually works.
(without devsh's cool compressed G Buffers though but..).

It is a thousand times faster though and allows me to use many lights
to light up the normals maps assigned to the materials of my characters
which is very cool!

So..
I update the tangents at every frame for every visible Skinned Object
to make sure that at any given frame of the animated skinned object the
normal mapped surface reacts "Physically Correct" to light striking it..
(particularly specular hotspots which are very noticeable if not correct).

Now all of this is great because I want many-many little normal mapped characters
lit by many-many lights! Cool hey?

BUT.. Read on..
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Part 2.. Disaster strikes.
The TANGENTS and BINORMALS that I update at every frame for every object
ARE NOT UNIQUE to every instance!!

It seems that Irrlicht somehow, internally, has ONLY ONE COPY of all these Tangents and Binormals
for all instances! (per loaded 3D Object)

What I mean, is that the Tangents and Binormals (which I'll from now on call the "TAN & BIN Pair")
for the FIRST Instance, is EXACTLY THE SAME "TAN & BIN Pair" for the Second Instance (or other instances)
which is VERY DEFINITELY NOT WHAT WE WANT..

You see, if one character is in one "State of Pose" and another character in another "State of Pose"
then Irrlicht does not know to which "Instanced Mesh" the SINGLE ARRAY OF TAN BINS are to be applied..

Irrlicht seems to try to handle this problem internally by trying to switch between the meshes probably
by at what the camera is looking at.. (I don't exactly know what it does)

I don't understand the problem fully, but I do know that it is an Irrlicht issue..

The solution (for me) would be to find a good work-around.
Another solution would be to have Irrlicht have TAN BIN Pairs just as UNIQUE as
the VERTICES and NORMALS.. (I don't have much experience with the engine coding itself)

What I do know..

I tried loading the same object twice and treat these two loaded objects
as separate instances. Surely now the problem should be solved? (even if temporarily)
NOPE! Irrlicht smartly sees that I, the coder, tried to load the same object twice and then
decided to NOT have the two objects in memory as separate items.. The Dataset as it exists
inside Irrlicht is ONE DATASET even if I loaded the same object twice! This is a good thing
but I still have the "Shared TAN BIN Pair" problem.

O.K. So just for my own clarification I copied the file and named it as something else
before loading it as the second object and.. Presto! These two objects now have their very
own set of tangents! (somewhat relieved as at least from this I know that I'm on the right track)

Now, from all of this I have the following question..

"How do I get Irrlicht to treat TAN BIN Pairs as uniquely
in Instances as it treats its Normals, Vertices and Materials"..

Now, I know jack about bug reporting and engine patching etc, but will gladly offer
my cooperation if anybody wants to address this issue for a next release..

This is a serious problem for me, so if anyone has
questions or advice, you have my ear!

Cheers!
Post Reply