User talk:Necolatis

From FlightGear wiki
Jump to navigation Jump to search

Model-combined shader issues

Hi, I've noticed that you've posted on the forums some issue with the model-combined* effects. Could you tell/show me what the desired effect was, what was the transparency setting for the glass material (in the .ac file)? (I'm the main author of those shaders)

The shader used is the same between the effects, the difference is how they are assigned to the various render-bins and the transparency hint, so that you don't get weird culling issues with objects behind the transparent ones, and so that it's properly handled by Rembrandt.

Using the non transparent variant will cause various issues across the board. (dissapearing bits of models behind the glass object, rainbow model in rembrandt, etc. )

I4dnf (talk) 09:23, 19 May 2014 (UTC)


Sure. First off, I did not test the transparency in Rembrandt yet. But it looks to work in normal and ALS.

I am not entirely satisfied yet, but getting this to work was a big step.

I have not discovered any issues with using it this way yet, but I did take the renderbin from the transparency effect, forgot to mention that in the forum-post.

MATERIAL "glassMat" rgb 0.8000 0.8000 0.8000 amb 0.0 0.0 0.0 emis 0.0000 0.0000 0.0000 spec 1.0000 1.0000 1.0000 shi 128 trans 0.5000

<!--ja37-glass-combined.eff-->
<PropertyList>
 <name>Effects/ja37-glass-combined</name>
 <inherits-from>Effects/model-combined-deferred</inherits-from>
 <parameters>
   <normalmap-enabled type="int">0</normalmap-enabled>
   <reflection-enabled type="int">1</reflection-enabled>
   <reflection-correction type="float">-0.5</reflection-correction><!-- -.5 -->
   <reflection-fresnel type="float">0</reflection-fresnel><!-- 0 -->
   <reflection-rainbow type="float">0.5</reflection-rainbow><!-- .25 -->
   <reflection-noise type="float">0.0</reflection-noise>
   <shade-model>smooth</shade-model>
   <texture n="2">
     <image>Aircraft/JA37/Models/Effects/ja37-glass-specular.png</image>
     <filter>linear</filter>
     <wrap-s>repeat</wrap-s>
     <wrap-t>repeat</wrap-t>
     <internal-format>normalized</internal-format>
   </texture>
   <texture n="5">
     <type>cubemap</type>
     <images>
       <positive-x>Aircraft/JA37/Models/Effects/ja37-glass-reflect.png</positive-x>
       <negative-x>Aircraft/JA37/Models/Effects/ja37-glass-reflect.png</negative-x>
       <positive-y>Aircraft/JA37/Models/Effects/ja37-glass-reflect.png</positive-y>
       <negative-y>Aircraft/JA37/Models/Effects/ja37-glass-reflect.png</negative-y>
       <positive-z>Aircraft/JA37/Models/Effects/ja37-glass-reflect.png</positive-z>
       <negative-z>Aircraft/JA37/Models/Effects/ja37-glass-reflect.png</negative-z>
     </images>
   </texture>
   <texture n="7">
     <image>Aircraft/Generic/Effects/Rainbow.png</image>
     <filter>linear-mipmap-linear</filter>
     <wrap-s>repeat</wrap-s>
     <wrap-t>repeat</wrap-t>
     <internal-format>normalized</internal-format>
   </texture>
   <!--WARNING: Do not edit below this line -->
    <!-- ####################
    ### TRANSPARENCY INCLUDE ###
    ######################### -->
      <rendering-hint>transparent</rendering-hint>
      <transparent>true</transparent>
      <render-bin>
        <bin-number>10</bin-number>
        <bin-name>DepthSortedBin</bin-name>
      </render-bin>
    <!-- ########################
    ### END TRANSPARENCY INCLUDE ###
    ############################# -->
 </parameters>
</PropertyList>

Necolatis (talk) 11:09, 19 May 2014 (UTC)


Just tested it in Rembrandt, it has a rainbow all over the screen.

:(

Necolatis (talk) 11:13, 19 May 2014 (UTC)


Yes, because you have only half-compatibility with rembrandt. Also, overriding texture n="7" is a bad idea. That is the old format, the new format has the fresnel and rainbow gradients in the same texture. In fact copying and duplicating the defaults in the local effect is a bad idea. Just copy those parameters you want to change from the defaults.
In the meantime try this:
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
    <name>ja37-glass-combined</name>
		<inherits-from>Effects/model-combined-transparent</inherits-from>
		<parameters>
			<normalmap-enabled type="int">0</normalmap-enabled>
			<lightmap-enabled type="int">0</lightmap-enabled>
			<reflection-enabled type="int">1</reflection-enabled>
			<reflection-correction type="float">-0.5</reflection-correction>
			<reflect-map-enabled type="int">0</reflect-map-enabled>
			<reflection-fresnel type="float">0.0</reflection-fresnel>
			<reflection-rainbow type="float">0.5</reflection-rainbow>
			<reflection-noise type="float">0.0</reflection-noise>
			<reflection-dynamic type="int">1</reflection-dynamic>
			<texture n="2">
				<image>Models/Effects/ja37-glass-specular.png</image>
				<filter>linear</filter>
				<wrap-s>repeat</wrap-s>
				<wrap-t>repeat</wrap-t>
				<internal-format>normalized</internal-format>
			</texture>
			<texture n="5">
				<type>cubemap</type>
				<images>
					<positive-x>Models/Effects/ja37-glass-reflect.png</positive-x>
					<negative-x>Models/Effects/ja37-glass-reflect.png</negative-x>
					<positive-y>Models/Effects/ja37-glass-reflect.png</positive-y>
					<negative-y>Models/Effects/ja37-glass-reflect.png</negative-y>
					<positive-z>Models/Effects/ja37-glass-reflect.png</positive-z>
					<negative-z>Models/Effects/ja37-glass-reflect.png</negative-z>
				</images>
			</texture>
			<rendering-hint>transparent</rendering-hint>
			<transparent>true</transparent>
			<render-bin>
				<bin-number>111</bin-number>
				<bin-name>DepthSortedBin</bin-name>
			</render-bin>
		</parameters>
</PropertyList>
BTW1: you'll notice that I've changed the paths so they are relative to the $aircraft folder. That way you are free to rename the aircraft folder without having to edit all the files containing hardcoded paths.
BTW2: shi of 128 is a bit high for glass/perspex. It gives you a very concentrated specular highlight. You might want to try values between 32 and 64.
I4dnf (talk) 11:47, 19 May 2014 (UTC)
Your suggestion works for ALS, but for Rembrandt and normal it just applies what looks to be the fixed pipeline. (I had same problem) I could solve it by using your suggestion for ALS, and combined-transparent for Rembrandt and model-reflect for the fixed.
I used to have the paths relative until a Linux user complained and then I changed all paths to be non-relative, but it probably works for shaders if you say it, so will keep it, thanks.
As for the shininess, I looked at pictures of the aircraft and the diameter of the specular spot, to make it match, it might be a little too high but not much I think, the cockpit glass of a fighter jet is highly polished and therefore give a small specular spot. But I will go back and check it.
Thank you for helping.
Necolatis (talk) 12:16, 19 May 2014 (UTC)
for Rembrandt and normal it just applies what looks to be the fixed pipeline
Ha, that's the issue. make sure you have the Model shader slider enabled. If you have it and still have the same issue, is there a way I can check the model myself ?
I4dnf (talk) 12:25, 19 May 2014 (UTC)
BTW:3 If the <texture n="2"> has a plain, uniform, full opaque alpha channel, then you don't need it. You only need that if you plan to change the amount of specular shown based on features in the texture. For a highly polished jet canopy most likely you don't want it.
I would also remove the <texture n="5"> and rely on the default cube-map, instead of using the same texture repeated 6 times. There are also a couple of other cube-maps to select from in Aircraft/Generic/Effects, but default should do just fine.
I.E. this simplified effect should do the job:
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
   <name>ja37-glass-combined</name>
   <inherits-from>Effects/model-combined-transparent</inherits-from>
   <parameters>
        <normalmap-enabled type="int">0</normalmap-enabled>
	<lightmap-enabled type="int">0</lightmap-enabled>
	<reflection-enabled type="int">1</reflection-enabled>
	<reflection-correction type="float">-0.5</reflection-correction>
	<reflect-map-enabled type="int">0</reflect-map-enabled>
	<reflection-fresnel type="float">0.0</reflection-fresnel>
	<reflection-rainbow type="float">0.5</reflection-rainbow>
	<reflection-noise type="float">0.0</reflection-noise>
	<reflection-dynamic type="int">1</reflection-dynamic>
	<rendering-hint>transparent</rendering-hint>
	<transparent>true</transparent>
	<render-bin>
		<bin-number>111</bin-number>
		<bin-name>DepthSortedBin</bin-name>
	</render-bin>
    </parameters>
</PropertyList>
I4dnf (talk) 12:32, 19 May 2014 (UTC)
The model sliders is on full when I test it, sorry. Yes, you can check it, Will post reply here when I have one uploaded that has the issue. Should be today.
Yes, my texture 2 is that, nice to know I can skip it. :)
I do not want the default texture 5, it has a different ground textures. Mine is blue/whitish sky color all around. So I don't reflect green ground when I am over white mountains etc.
Necolatis (talk) 19:34, 19 May 2014 (UTC)
I made a mistake when copying the file, I was again using model-transparent. When fixing it it works for normal pipeline also. In rembrandt it still has the rainbow though, but I can just apply a different shader for Rembrandt.
And btw. about the specular spot I remember now that the 128 value is adjusted for fixed pipeline without shader, since I think most is using that anyway, so that should dictate when the shininess should be, even though with shaders applied it might get a bit too small as you said. Maybe I can make a material animation that changes the value when a shader is applied, I will have to look into that.
Necolatis (talk) 19:51, 19 May 2014 (UTC)
One more thing, has the rainbow effect been changed from model-reflect? It is now either very subtle or not there at all, I have trouble spotting it. Same with noise.
The rainbow/noise/fresnel effects are modulated by the reflection-correction parameter too. You have set a very low reflection-correction, so those effects will be less visible too.
If you want to use a custom cubemap, make sure you make the caps proper (sky and ground caps need to be different from the sides)
IMHO once you use effects, you should configure your model for best results with effects, and then, if possible care for the fixed function pipeline. Also the fixed function pipeline won't be there in the future, so too much caring for it is a bit of a waste of time. (I'm not saying you should allow buggy appearance in the fixed function pipeline, just don't use it as primary test). It really isn't more than a safe fall-back now.
I am really curious what's going on on your system, as this stuff works properly across many systems. Do you have generic shaders enabled too ?
The whole idea of the model-combined-transparent is that you don't have to apply a separate effect for each of the frameworks active (default/ALS/rembrandt), so if it fails to work properly I would like to find out the root-cause. Same for model-combined-deferred for opaque objects.
I4dnf (talk) 21:35, 19 May 2014 (UTC)
No matter what I do, I cannot get the rainbow effect on the glass nor the dirt effect on my nozzle. If you would like to take a look at the model, it is here: https://sites.google.com/site/fghangar/
Not sure what you mean by side caps have to be different from up/down caps.
Okay, its just when I look in forums, most seem to have slow computers so I tend to cater for that, but I would also prefer to prioritize shaders. :)
Does generic shaders have any influence on model shaders? They are sorta random when I test model shaders..
Necolatis (talk) 11:30, 20 May 2014 (UTC)
Hi,
In General you have to adjust the .ac-material of you glass as well. The appearence of the glass changes a lot with its own material settings.
I see that the ambient values are not equal with the diffuse values in the materials.
I'm surprised about the strange use of the effect in ja-37.xml. There is no need for a special effect file for Rembrandt.
Then you need a real Cubemap. A Cubemap is 360deg x 180deg image of an environment projected on a cube. Each face of the cube represents then the needed image.
So each of them shows a different part of the environment which should be used as reflection.So <positive-x> shows a different part of the reflecting environment as <positive-y>
In Aircraft/Generic you will find a folder with some different cubemaps you can try and use.
You may want to take a look on the EC130 B4 or EC135 P2 (In my Gitorious hangar)- it uses the effect files with success and you can try different values for rainbow or dirt.
If it doesn't work there, there is probably a bug. I remember some time ago having similar problems like you.
And of course Generic Shaders should be engaged.
Btw: the "fresnel effect" isn't the real fresnel effect. Fresnel would mean that the strength of the reflection effect would change by angle of view on it. Like water.
Cheers--HHS (talk) 16:25, 20 May 2014 (UTC)
Yes, I just found that out. I had adjusted the AC material values to look okay without shaders, and then trying to fit the shaders to whatever values they were. I realise now I have to adjust both ways.
Yes, clear polished glass do not show ambient light very well, which is why reflection and specular is all the features I hope to see on the glass. I know it is not custom here to do it that way, but I hope to get away with it and still have some nice glass. But if the shader requires it, then I have to put it on ofcause.
I4dnf already showed me that its not so good to have conditional separate effects, thanks though.
I do know what a cubemap does. My cubemap has no features due to the different environments the plane flies over change, while the cubemap does not. But after looking at your helicopter I see that it is not so clear to see the reflection, which I like, I might consider switching. :)
I have trouble getting the dirt visible with the combined shader, but I am going to see if its due to material values in the AC file.
I was not aware that the generic shader should be active, thanks some of my issues might be due to that.
Necolatis (talk) 17:33, 20 May 2014 (UTC)

Renaming or rather moving pages

A better way to move pages than "blanking" a page and copying the contents to a new page is to use the "Move" tab (should be right beside the "View history" tab or hidden under the tab with the upside down triangle).

When moving a page that way you can chose to leave or not leave a redirect, moving the talk page as well. More important though is that the page will have a complete edit history.

Please move pages instead. ;-)

You can undo the blanking when looking at the page history, and then move it. I would have to delete the new page before you can move the old page there, so copy any recent additions to the old page and put a speedy deletion template there on the new page.

Johan G (Talk | contribs) 19:58, 26 December 2014 (UTC)

Done. --Necolatis (talk) 21:44, 26 December 2014 (UTC)
Ok, I have now deleted the new page title. You can now move the original page to the new title. :-)
Johan G (Talk | contribs) 22:02, 26 December 2014 (UTC)
Wow, that was quick. You moved it even before I managed to fix my spelling.  ;-)
It will be interesting to see the how failure manager develop and hopefully pass the point where it gets integrated into FlightGear.
Johan G (Talk | contribs) 23:18, 26 December 2014 (UTC)
Yeah, got an e-mail when it was deleted. Yes, I hope it will pass that point also. :)
--Necolatis (talk) 01:49, 27 December 2014 (UTC)

JSBSim rotor

Hi,

did you notice we already have a section on FGRotor at JSBSim Thrusters#FGRotor? The rotor is not an engine but a thruster after all...

Cheers, Gijs (talk) 06:59, 9 April 2016 (EDT)

Nope, sorry.
--Necolatis (talk) 12:05, 9 April 2016 (EDT)

Linking to categories

Hi,

just a small tip, you can link to categories on the wiki by adding a colon in front of the link. See Help:Formatting#Links to categories, files and other language versions ;-)

Cheers, Gijs (talk) 10:02, 26 October 2016 (EDT)