Jump to content

A "psychic" shader mod; development begins...


DanW58
 Share

Recommended Posts

33 minutes ago, DanW58 said:

Hrmmm...  The last Windows I worked with was XP;  I wasn't aware of "compressed folders" at all.  I'm so sorry.

It's just a zip file, they like to complicate things.

One thing you could do is provide a pyromod file :) Then anyone with 0ad installed can double click to install it for their game :)

basically it's a zip file renamed to .pyromod. It's exactly the same folder structure you use in the public mod. here is an example.

 

dan-shaders.pyromod

 

file structure
DAN-SHADERS
|   mod.json
|
\---shaders
    \---glsl
            model_common.fs
            model_common.vs
            terrain_common.fs
            water_high.fs

 

  • Like 1
Link to comment
Share on other sites

Okay, so I go into the ~/0ad/binaries/mods/public/ folder, I create a zip file, include the four files in /shaders/glsl/ and all the xml files in /art/materials/ and then rename the file?

EDIT:  The "mod.json" in it is just a text file I should write and include in /public/ ?

Edited by DanW58
Link to comment
Share on other sites

Cool!  So glad to hear!  In the meantime I'm still hacking the high water shader (water_high.fs) ;-)

Managed to hide the repeating tiles of the waves by mixing the wave pattern with different scalings and rotations.

I also got rid of the terrible artifacts I was getting on land;  it was just a funny constant in the Fresnel approximation routine that is supposed to be 1.0 but anything less than 1.12 causes those artifacts.

Now I have 1 artifact left at a distance, which this funny constant doesn't fix...

 

water1artifact.jpg

Link to comment
Share on other sites

10 hours ago, Stan` said:

 




file structure
DAN-SHADERS
|   mod.json
|
\---shaders
    \---glsl
            model_common.fs
            model_common.vs
            terrain_common.fs
            water_high.fs

 

Man, why does life have to be so difficult?  Archive Manager AND Ark BOTH have no option for keeping the folder structure.  Then Xarchiver has two options:  Full path, or NO path;  no option for relative path;  and it crashes anyways;  tells me to check some viewing option to see the error, which viewing option is nowhere to be found.  Linux coders, 90% of them, seem bent on pushing people away from using the OS;  they booby-trap everything they do.

How do you make this zip file, Stan?

EDIT: Spent like two hours searching the internet for what's a good archive manager; and they all agreed it is PeaZip.  Had to install a special installer to get it installed.  Full of options, but I specified to keep paths of the files;  but when I test the file it extracts everything in a folder it creates by the name of the zip file.  There's no end to suffering...

Edited by DanW58
Link to comment
Share on other sites

Generally I do this kind of folder setup by making a temporary 'staging' folder somewhere and then replicate the folder structure and copy in my files.

Once this is done, you can install this as a mod into your own copy of 0 A.D. and instead of directly modifying game assets, you just modify your 'mod' files instead. If you need to add more files to the scope of the mod, just copy them out of the game files and into your mod and modify there.

This is very useful for sound stuff at least, where I can A/B test new and old sounds by disabling the mod, no need to uncomment lines or even move around files. I can imagine you might find the approach useful too.

I would start with Stan's mod file, extract the contents and/or install it, and then replace the files in the folder structure he's already made for you with the latest files you've updated. Continue work as usual working only in this mod folder, with the mod installed. When you have a new version for people to check out, pack up as a .zip and upload for everyone to try, no need for fancy archive management. :)

Edited by Samulis
  • Thanks 1
Link to comment
Share on other sites

From what i know, it should create this subfolder:
"

Each mod is contained within its own folder, which should have the same name as the mod. Thus, a mod named my_awesome_mod would be placed in the folder ./0ad/mods/my_awesome_mod/.

"

https://trac.wildfiregames.com/wiki/Modding_Guide#Wherearethemods

 

modfolder_collection.jpg

Edited by maroder
Link to comment
Share on other sites

1 hour ago, DanW58 said:

Not working for me.  Even using Stan's file;  I place it into a test folder, but it creates a "dan_shaders" folder.  Even if I right-click and say "Extract Here";  no matter, it always creates a stupid subfolder.

Just move it out of the subfolder after extracting?

Layout should be:

  • (mods}
    • dan-shaders
      • shaders
        • glsl
          • fs & vs files
      • mod.json
Edited by Samulis
Link to comment
Share on other sites

Thanks, guys, but I'm having a breakdown here.  I did everything as you guys said.  I created a test folder.  Extracted Stan's zip;  it created dan_shaders folder with a shaders subfolder and a glsl sub-sub-folder.  I replaced all 4 files with latest versions.  I added the art/materials folder, with all the xml files.  Opened Stan's zip file again with PeaZip, went to AddFile, added all the files, saved.  Then open the result with ArchiveManager and it wants to unzip all the files in the one subfolder.  This stuff is INSANE to try to understand.

Link to comment
Share on other sites

I'm using Linux, but I'm an eternal newbie at it.  The only thing I hate more than Linux is Microsoft;  that's how I'm here.

Okay;  what I'm trying to find out is how to create a mod;  not how to unzip one.  I'm having a hard time persuading all these archiving tools to keep the file-paths when adding to a zip.

 

Edited by DanW58
Link to comment
Share on other sites

Okay, I think I got it;  hope it works.

Includes metal and skin detection.  Metal is enhanced by matching hue of diffuse and specular and ensuring that diffuse saturation is higher than specular's, but not much higher;  and that specular value is higher than diffuse.  Skin is enhanced by adding partial Fresnel specularity to it, of low gloss (skin is colored in diffuse, but shimmer-reflects white), and by adding a hack to make it seem like it gives a hint of red translucency.

Unfortunately, skin and metal are very hard to distinguish by color, and sometimes they cross into each other.  Also, patches of grass and other things may detect as skin, or as metal;  but they don't look bad;  just a bit shinier than they should be.

Something no other shader has is a mega-hack to compute specular occlusion.  That is, figure out if a sight ray reflecting off a shiny surface should reflect sky, or an object nearby.  The common wisdom is that you need real time ray-tracing to get specular occlusion.  Well, I got it to work based on the baked ambient occlusion.  If you look at shiny pots or shields inside shady patios, you can see a limited reflection of sky on them that keeps facing you as you turn around the building.

Also included is the latest water shader, with more realistic Fresnel specular and refractive factors, and with a hack to make coasts look wet.

The terrains shader detects soils or tilings that are too white, and tones them down while increasing contrast.  Ambient occlusion (ambient light self-shadowing) of buildings is better displayed.  The material xml files are changed, in fact, to standardize the gain for ambient occlusion bakings to 1.0, rather than have manually adjusted gains everywhere.  Also in the terrains shader there is a blue-tinted upward bias on ambient light, as most ambient light comes from above, and has a blue tint due to atmospheric scattering.

For perspective, there are many shaders out there that do things like Fresnel;  specular highlights, environment mapping and whatnot;  however, they need to be told, via textures, what to do.  The peculiar thing about this metal and skin shader is that it figures out what to do without being told... :alien:  It's a way to enjoy a tiny hint of what will be coming next, without the work of adding new textures and all that.

If there's any problems, shader not compiling, whatever, please report it to this thread.  You may need to turn all the graphics options to maximum;  I haven't even tested it non-maxed-out.

metal_shader_set.pyromod

waterworks.jpg

Edited by DanW58
  • Like 2
  • Thanks 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...