User talk:Necolatis: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
mNo edit summary
Line 194: Line 194:
::::::: 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.
::::::: 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.
::::::: [[User:I4dnf|I4dnf]] ([[User talk:I4dnf|talk]]) 21:35, 19 May 2014 (UTC)
::::::: [[User:I4dnf|I4dnf]] ([[User talk: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..
::::::::[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 11:30, 20 May 2014 (UTC)

Revision as of 11:30, 20 May 2014

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)