New Release D3D9Client Development

SolarLiner

It's necessary, TARS.
Addon Developer
Joined
Jun 14, 2010
Messages
1,847
Reaction score
2
Points
0
Location
404 ROAD NOT FOUND
I made an attempt at a LUT color correction effect, but then I remembered I wasn't in ReShade, and couldn't load directly from the shader itself...
Which means to continue I'll have to be able to compile the code by myself, which any previous attempt failed.

Onwards... :coffee:

---------- Post added at 18:50 ---------- Previous post was at 18:38 ----------

Also, regarding the optimization of the box blur;
The way to do it is by first populating all the samples from the 1D kernel (let's say 9 for a radius of 4 (from -radius to +radius with a center pixel), and for each pixel of the row, deleting the left most pixel from the kernel and adding the new right-most pixel.

But that means that the color array is persistent throughout the execution of the shader on an image; and there's no way of having a global variable that persists through the shader's lifetime; that means there's no way of being able to void the kernel size's influence on the shader complexity.

Am I missing something?
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
But no luck, from what I can see one of the new maps gets rendered on a different texture (ceiling), and normal maps are also only used in one material.

Some of the base building are non-standard meshes. I'll take a look if I can figure out what's going on.

One issue I mentioned earlier is a fresnel reflection. The reflection intensity is dependent on a viewing angle and it typically appears on glass and plastics.

I suppose conditions could be:

1) Material is very smooth like glass
2) Reflectivity is low (would specify minimum reflectivity and color when viewed from a high angle)

When viewed from a shallow angle the reflectivity would increase and the color would shift towards white.

---------- Post added at 04:15 ---------- Previous post was at 04:01 ----------

I made an attempt at a LUT color correction effect, but then I remembered I wasn't in ReShade, and couldn't load directly from the shader itself...
Which means to continue I'll have to be able to compile the code by myself, which any previous attempt failed.

If you are talking about compiling the client then that shouldn't be too difficult. There aren't many dependencies, mostly DX SDK.


But that means that the color array is persistent throughout the execution of the shader on an image; and there's no way of having a global variable that persists through the shader's lifetime; that means there's no way of being able to void the kernel size's influence on the shader complexity.

If the global variable is pixel specific then alpha channel is available. But currently it's only 2-bits. Also, the latest build has a PassId that allows to identify the pass being executed. It would also be possible to define a different code sections for a different passes but that's not currently implemented.

My first implementation of blur effect used accumulator buffer where each frame added more information. But it showed annoying motion blur effect at low framerates and it had some stability problems. The "color = max(color, tex2D())" approach was more stable in that kind of scenario than Gaussian blur/box blur.

Also, only a global booleans can be used efficiently to toggle code sections on and off.

---------- Post added at 04:22 ---------- Previous post was at 04:15 ----------

But for compatibility reasons, I'd define them only by textures. For uniform materials that means a small 8x8 uniform texture, so no problem there.

In D3D9 we have a small material editor that allows to edit and save a D3D9 specific material setup for a mesh. These configurations are located in /Config/GC/ and applied to a mesh when loaded.

Also, the inline engine doesn't use fresnel nor reflectivity material parameters so those could be stored in a meshes too but that's not currently supported.
 
Last edited:

4throck

Enthusiast !
Joined
Jun 19, 2008
Messages
3,502
Reaction score
1,008
Points
153
Location
Lisbon
Website
orbiterspaceport.blogspot.com
Fresnel reflection: I understand the effect and perhaps that's where a reference render would help.

Material editor: Yes, used that for some of my updated textures. Certainly handy and it works well with the new parameters.
I'll try to create some sample untextured materials using it, so that we have more things to test.



The important thing is that both seem to be working as intended:
View attachment 14453

:thumbup:
 
Last edited:

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
In D3D9 we have a small material editor that allows to edit and save a D3D9 specific material setup for a mesh. These configurations are located in /Config/GC/ and applied to a mesh when loaded.
By the way: I think that the 'pick' feature in trunk is currently a bit broken (since you fixed the 'globe at poles' bug, maybe?).
If you could take a look at that, please. I'll try to look into it as well, but I think you can fix it much easier/quicker.
Regards,
Kuddel
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
By the way: I think that the 'pick' feature in trunk is currently a bit broken (since you fixed the 'globe at poles' bug, maybe?).

Removed the red tile, couldn't find anything else wrong.
 

SolarLiner

It's necessary, TARS.
Addon Developer
Joined
Jun 14, 2010
Messages
1,847
Reaction score
2
Points
0
Location
404 ROAD NOT FOUND
Okay, so I think this will be pretty much the final version of the LightBlur, for me at least.

I changed the way the glow intensity is taken into account: it now does its effect before the blurring pass, whhich makes it less likely the blur buffer will get saturated (luminosity over 1.0), thus giving a much better look with intensities below 1, which are pretty much required given how strong the effect is.
The results are in; and like how I like it, it's a diffuse and 'subtle' (on the less-than side of things, though, but still :lol: ), but is there.

I've also included the CLUT pass as another shader, obviously it's not working but if I am able to build the client I'll work on getting that fixed ;)

Remember to play around with the numbers at the top of the shader to get your own perfect setting, and please share it with me!
 

Attachments

  • LightBlur.zip
    9.7 KB · Views: 8
  • 0012.jpg
    0012.jpg
    62.7 KB · Views: 41
  • 0013.jpg
    0013.jpg
    94.3 KB · Views: 38
  • 0014.jpg
    0014.jpg
    86 KB · Views: 40

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
Thanks, I'll take a look if I can convert the CLUT.png to 3D texture and load it to the shaders. Wouldn't it be better to do in LightBlur.hlsl instead of creating it's own shaders ?
EDIT: Ok, Done.
 
Last edited:

SolarLiner

It's necessary, TARS.
Addon Developer
Joined
Jun 14, 2010
Messages
1,847
Reaction score
2
Points
0
Location
404 ROAD NOT FOUND
The reason I kept it a 2D texture is for everyone to be able to easily make their own. Color correction tools like this are very powerful and everyone could make it up to his preference. In regards of how easy a 3D texture can be edited, I honestly don't know, because I never came across one yet.

I was navigating the code, and I'm still searching for the relevant piece to tweak here. I was expecting a jungle, but I wasn't exactly expecting the Amazon... :lol:

---------- Post added at 14:05 ---------- Previous post was at 14:01 ----------

Oh, right, it's in the Experiment branch. Can you pick up the noob here? :lol:
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
Ok, here is a new build.

The CLUT texture is now available and should be possible to sample with tex3D() call but I haven't tried yet.

Pass count, buffer resolution and backbuffer format can be changed with these parameters from LightBlur.hlsl.

PHP:
#define BufferDivider	2		// Blur buffer size in pixels = ScreenSize / BufferDivider
#define PassCount		2		// Number of "bBlur" passes
#define BufferFormat	1		// Render buffer format, 0=RGB10A2, 1 = RGBA_16F

There is also on/off toggle option added in launchpad settings for post-processing effects.

Currently there appears to be a problem with post processing effects effecting to the Earth as well in addition to meshes. That would need some sort of solution. Stencil mask maybe ?
 

Attachments

  • D3D9ClientBeta-TestBuild5.zip
    1.7 MB · Views: 53

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
Ok, so the CLUT is for users to do color corrections for their display device. I though your were planing to shade a rainbow or something... :lol: Well, in that case it takes a lil more thinking how to properly apply it in user friendly way.

---------- Post added at 18:41 ---------- Previous post was at 17:59 ----------

Okay, so I think this will be pretty much the final version of the LightBlur, for me at least.

That actually works pretty well. Definitely best so far. :thumbup: The glow intensity and range is a matter of taste but it seems to scale pretty well.
 

4throck

Enthusiast !
Joined
Jun 19, 2008
Messages
3,502
Reaction score
1,008
Points
153
Location
Lisbon
Website
orbiterspaceport.blogspot.com
Testbuild 5 seems to work ok.

Played a bit with the debuger and here are some materials for the DG:
Code:
; =============================================
MESH DG\deltaglider_ns
; ---------------------------------------------
MATERIAL 24
AMBIENT 0.525490 0.525490 0.525490
DIFFUSE 0.603922 0.603922 0.603922 0.305882
SPECULAR 0.960784 0.960784 0.960784 849.986328
REFLECT 1.000000 1.000000 1.000000
FRESNEL 1.576471 0.000000 0.796079
; ---------------------------------------------
MATERIAL 16
SPECULAR 0.188235 0.188235 0.188235 4.090390
REFLECT 0.333333 0.333333 0.333333
; ---------------------------------------------
MATERIAL 10
SPECULAR 0.253307 0.090196 0.000000 3.205401
REFLECT 0.419486 0.419608 0.419486
; ---------------------------------------------
MATERIAL 17
SPECULAR 0.172549 0.172549 0.172549 2.511887
REFLECT 0.235589 0.235294 0.235589
; ---------------------------------------------
MATERIAL 12
SPECULAR 0.399897 0.423529 0.423529 3.119735
REFLECT 0.700000 0.700000 0.770000
; ---------------------------------------------
MATERIAL 13
SPECULAR 0.973000 0.949000 0.886000 4.090390
REFLECT 0.525490 0.149020 0.000000
; ---------------------------------------------
MATERIAL 14
SPECULAR 0.537255 0.082353 0.000000 1.864611
REFLECT 0.501961 0.501961 0.501961
; =============================================
MESH DG\deltaglider_vc
; ---------------------------------------------
MATERIAL 14
AMBIENT 0.225490 0.270588 0.270588
DIFFUSE 0.699347 0.839216 0.839216 1.000000
SPECULAR 0.794659 0.796079 0.794659 8.733262
EMISSIVE 0.000000 0.000000 0.000000
REFLECT 0.748455 0.748455 0.749020
; ---------------------------------------------
MATERIAL 8
SPECULAR 0.271000 0.271000 0.271000 5.080219
REFLECT 0.462745 0.462745 0.462745
; ---------------------------------------------
MATERIAL 5
SPECULAR 0.890196 0.890196 0.890196 2.315826
REFLECT 0.690196 0.294118 0.172549
; ---------------------------------------------
MATERIAL 18
AMBIENT 0.215686 0.215686 0.215686
DIFFUSE 0.356863 0.356863 0.356863 1.000000
SPECULAR 0.796079 0.796079 0.796079 2.379417
EMISSIVE 0.745098 0.745098 0.745098
REFLECT 0.792157 0.792157 0.792157
; ---------------------------------------------
MATERIAL 23
SPECULAR 0.400000 0.400000 0.400000 4.090390
REFLECT 0.215686 0.215686 0.215686

Nothing too fancy, just some window reflections, metallic landing gear and a somewhat plastic cockpit.
View attachment 14459
View attachment 14460
View attachment 14461

For the cockpit to be better we would need Ambient Occlusion and shadows.
Otherwise light magically comes from behind the panel and illuminates the objects.
As with all this, not a complaint, just food for though! I know that it also depends on how meshes are built (separate groups), intersecting groups, etc, etc.

Looking good :thumbup:
 
Last edited:

SolarLiner

It's necessary, TARS.
Addon Developer
Joined
Jun 14, 2010
Messages
1,847
Reaction score
2
Points
0
Location
404 ROAD NOT FOUND
SSAO could be done with an access to the depth buffer, but it's a quite old technique, and while it works, there are better ways out there. This article needs to be read and understood for it to be worth the implementation.

For the Color LUT, I'm getting back on it.
 

SolarLiner

It's necessary, TARS.
Addon Developer
Joined
Jun 14, 2010
Messages
1,847
Reaction score
2
Points
0
Location
404 ROAD NOT FOUND
CLUT is implemented, but I think it's better to return to a 2D texture as I'm playing with different setups. So I tweaked the source code, and I got it to compile!
Though... I dun goof'd (just fyi: this is my first major graphics project, so that explains things)
 

Attachments

  • 0020.jpg
    0020.jpg
    350.7 KB · Views: 59

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
Removed the red tile, couldn't find anything else wrong.
Yeah, 'picking' seems to be working as expected again.
I remember some spheres appearing when 'picking' as well, but that seems to be gone, too :thumbup:

Thanks,
Kuddel
 

DaveS

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
9,429
Reaction score
680
Points
203
You make me "wear my sunglasses at night"...
I agree if this is in reference to the blooming AKA light blur. Currently it washes everything out decreasing the realism severely. It either needs to be tuned way down or removed entirely. Right now it just creates sort of a foggy effect which looks just wrong and bad.
 

4throck

Enthusiast !
Joined
Jun 19, 2008
Messages
3,502
Reaction score
1,008
Points
153
Location
Lisbon
Website
orbiterspaceport.blogspot.com
Yes. The blur makes sense if we have "out of scale" brightness values (whiter that white).
If we blur only those, the end effect would be nice. I guess it's related to HDR:hmm:
Anyway, it should be a small effect (~8 pixels or something)

Here's a nice example (look at the light behind the left post):
mood23_1.jpg
 

Enjo

Mostly harmless
Addon Developer
Tutorial Publisher
Donator
Joined
Nov 25, 2007
Messages
1,665
Reaction score
13
Points
38
Location
Germany
Website
www.enderspace.de
Preferred Pronouns
Can't you smell my T levels?
I agree if this is in reference to the blooming AKA light blur. Currently it washes everything out decreasing the realism severely. It either needs to be tuned way down or removed entirely.
Yes, it was, though it made more of a wow effect than a dislike. I agree that it could be tuned down a bit though.
 

SolarLiner

It's necessary, TARS.
Addon Developer
Joined
Jun 14, 2010
Messages
1,847
Reaction score
2
Points
0
Location
404 ROAD NOT FOUND
You can change the values in the #defines to your own liking. When I submitted the effect it had parameters for a subtle but diffuse bloom, for a more cinematic look. In the latest test build after jarmonik's touches to the shader, it went back to a stronger but "less blurred" look which I like less. To each their own ;)
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
I agree if this is in reference to the blooming AKA light blur. Currently it washes everything out decreasing the realism severely. It either needs to be tuned way down or removed entirely. Right now it just creates sort of a foggy effect which looks just wrong and bad.

It is experimental feature and right now I am trying to figure out how to do it properly. It also has on/off toggle in a launchpad settings.

---------- Post added at 18:23 ---------- Previous post was at 18:12 ----------

Yes. The blur makes sense if we have "out of scale" brightness values (whiter that white).
If we blur only those, the end effect would be nice. I guess it's related to HDR:hmm:
Anyway, it should be a small effect (~8 pixels or something)

Here's a nice example (look at the light behind the left post):
mood23_1.jpg

One thing to note is that the light has a warm yellowish look. It isn't over saturated white. Red and green channels are somewhere around 250 and blue little less. It looks good because it's done properly.

Applying that effect/look into existing orbiter model, textures and material could be a challenge. It could require some color transforms for textures and materials which would result compatibility issues with the DX7. I guess we have little less freedom and flexibility than regular game developers. They don't have compatibility issues to worry about.

---------- Post added at 18:29 ---------- Previous post was at 18:23 ----------

You can change the values in the #defines to your own liking. When I submitted the effect it had parameters for a subtle but diffuse bloom, for a more cinematic look. In the latest test build after jarmonik's touches to the shader, it went back to a stronger but "less blurred" look which I like less. To each their own ;)

Sorry, but I haven't published any modifications to your latest shader.

I'll make the depth texture available for the shaders, that could help a bit with distance scaling and avoiding over saturating the horizon.
 
Top