View unanswered posts | View active topics It is currently Wed Aug 21, 2019 9:31 am



Reply to topic  [ 10 posts ] 
Splinter's Shaders Modifications (With Explanations) 
Author Message
User avatar

Joined: Tue Dec 22, 2015 9:44 pm
Posts: 668
Reply with quote
Image
Image


EDIT: I'm taking down my cvar.txt download for now since it set "kLoadSuperFast = 1" which causes non-terran factions and spikey-plants to not load correctly. You can still ask me for a copy though...


The mod can be found at http://steamcommunity.com/sharedfiles/f ... =644263599



EDIT: Also the mod is more up to date than the below information for now. So far the mod contains a fix for ship greyification and readability issues due to chromatic aberration as well as small bullet visibility.



So a few people have been asking me about the shaders and cvars I was tweaking for my 12Kings Tournament and I promised to follow up on this. I'll be going over a few of the changes I've made and I'll detail the meaning behind some of the changes. Also note that I have made some changes today that may not have been seen before during the test event due to feedback from the test event. My shaders.lua and cvars.txt file are included as downloadable files at the bottom of this post. I'll be posting a corresponding steam workshop mod soon (arthur has permission to use changes in the future if he wants to). Caution, the following changes may affect your computer performance, but hopefully not by much.

Make sure to backup your files before you change them!

The two main areas of change are:
C:\Program Files (x86)\Steam\steamapps\common\Reassembly\data\shaders.lua <- Controls how some things are drawn, please save a backup of this
C:\Users\[USER]\Saved Games\Reassembly\data\cvars.txt <- remember that you must remove the pound sign from the lines you want changed, please save a backup of this

I am using a separate font called loaded.ttf which can be placed here:
C:\Program Files (x86)\Steam\steamapps\common\Reassembly\data\loaded.ttf
Since this forum doesn't allow the ttf extension to be attached, I have changed it to a txt file; simply remove the txt extension if you wish to use it after downloading it.




The shaders.lua changes require the most explanation, so I'll go over each change: Commentary will occur after the "//" symbol

1. ShaderIridescent (Lines 12-27): Controls ship block colors

Code:
   ShaderIridescent = {
      "varying vec4 DestinationColor;"
      ,
      "attribute vec4 SourceColor0;
      attribute vec4 SourceColor1;
      attribute float TimeA;
     
      // Include this in order to use snoise
      #include 'noise3D.glsl'
     
      void main(void) {
          gl_Position = Transform * Position;
          // snoise is normally used to draw the wormhole
          float val = snoise(vec3(0, Time, TimeA));
         
          // Sprinkle in some more iridescence and normalize overly dark and light blocks
          DestinationColor = vec4(0.3) + mix(SourceColor0, SourceColor1, val)
              * vec4(normalize(vec3(sin(Time*2), sin(Time*2+TimeA), sin(Time*2 + 2*TimeA)))*0.02 + vec3(0.4), 0.5);
      }"
      ,
      "
      void main(void) {
            gl_FragColor = DestinationColor;
      }"
   },



2. ShaderTexture (Lines 142 - 159): I mostly changed this for chromatic aberration (the Red/Blue effect)
Code:
   -- passthrough texture shader - used in many places for drawing render targets
   ShaderTexture = {
      "varying vec2 DestTexCoord;
       varying vec4 DestColor;\n"
      ,
      "attribute vec2 SourceTexCoord;
      uniform vec4 SourceColor;
      void main(void) {
          DestTexCoord = SourceTexCoord;
          DestColor    = SourceColor;
          gl_Position  = Transform * Position;
      }"
      ,
      "uniform sampler2D texture1;
       void main(void) {
       
           // You can also use: vec2 direction = vec2(0.001, -0.0002);
           vec2 direction = (DestTexCoord - vec2(0.5))/500;
           
           gl_FragColor = DestColor * vec4(
             texture2D(texture1, DestTexCoord + direction).r,
             texture2D(texture1, DestTexCoord + direction * 0.5).g,
             texture2D(texture1, DestTexCoord + direction * 0.5).b,
             
             // Replace the following line with 1 to experience CIA Mode
             texture2D(texture1, DestTexCoord).a
          );
       }"
   }


3. ShaderTonemap (Lines 191 - 219): HDR code changed to make explosions stand out without making engine trails overpower the screen
Code:
   -- HDR postprocessing. makes really bright areas (i.e. with a lot of particles) more white to make them look brighter
   ShaderTonemap = {
      "varying vec2 DestTexCoord;"
      ,
      "attribute vec2 SourceTexCoord;
      void main(void) {
          DestTexCoord = SourceTexCoord;
          gl_Position  = Transform * Position;
      }"
      ,
      "uniform sampler2D texture1;
      uniform sampler2D dithertex;
      void main(void) {
          vec2 texCoord = DestTexCoord;
          vec4 color = texture2D(texture1, texCoord);
         
          if (color.rgb != vec3(0.0))
          {
              // Prevent already-white colors from overpowering the screen
              float mx = max(0, max(1.5 * color.r - color.g - color.b,
                  max(1.5 * color.g - color.b - color.r, 1.5 * color.b - color.r - color.g)));
             
              if (mx > 0.1) {
                  color.rgb += (normalize(color.rgb) * 1.5 + color.rgb * 0.25 + vec3(max(-0.75, 0.0 + mx)) * 0.5) * max(0.1, min(2, 1 + log(mx))) *0.75;
              }
           
            #if DITHER
              float ditherv = texture2D(dithertex, gl_FragCoord.xy / 8.0).r / 128.0 - (1.0 / 128.0);
              color += vec4(ditherv);
            #endif
          }
          // Adjust based on particle brightness preference
          gl_FragColor = color * 0.75;
      }"
   },


4. ShaderParticlePoints (Lines 334 - 380): (Top section only): Most changes here are for extending and reshaping missile/thruster trails
Code:
      "attribute vec2  Offset;
       attribute float StartTime;
       attribute float EndTime;
       attribute vec3  Velocity;
       attribute vec4  Color;
       uniform   float CurrentTime;
       uniform   float ToPixels;
       void main(void) {
       
           float deltaT = (CurrentTime - StartTime);
           float v = deltaT / (EndTime - StartTime);
           
           // Shrink over time
           float size = max(0, 0.25 + ToPixels * Offset.x * min(3, 6 - v)/2);
           
           if (size < 0.1) {
               gl_Position = vec4(0.0, 0.0, -99999999.0, 1);
               return;
           }
           
           // Adhere more to the trail
           vec3  velocity = pow(0.4, deltaT) * Velocity / 4;
           vec3  position = Position.xyz + deltaT * velocity;
           
           // Fade over time
           DestinationColor = max(0.0, min(2, 3 - v)/6) * max(0.5, min(4, 8 / size )) *
           (
               Color + vec4(sin(deltaT*2), sin(deltaT*2+CurrentTime), sin(deltaT*2 + 4*CurrentTime), 1) * 0.005
               // Secret Mode: * (25 + 25 * vec4(normalize(velocity)/8 + vec3(0.3), Color.a))
           );
           
           Sides = Offset.y;
           gl_PointSize = size;
           gl_Position = Transform * vec4(position, 1);
       }"


5. ShaderBlur (Lines 383 - 398): the following code slightly reduces the brightness of the blurred afterimage in the background when transitioning between pages. Caution, changing this will also affect general brightness as well
Code:
   -- full screen blurs.
   ShaderBlur = {
      "varying vec2 DestTexCoord;"
      ,
      "attribute vec2 SourceTexCoord;
       void main(void) {
           DestTexCoord = SourceTexCoord;
           gl_Position  = Transform * Position;
       }"
      ,
      -- BLUR expands to the sum of a number of texture2d calls depending on the blur radius
      "uniform sampler2D source;
       uniform vec2 offsets[BLUR_SIZE];
       void main() {
           // Adjust based on background afterimage brightness preference
           gl_FragColor = 0.75 * BLUR(source, DestTexCoord, offsets);
       }"
   }



Image


Relevant Cvar Changes: (Some are still the same as its default value)

### Enable bloom for blocks
kBloomBlocks = 1
kBloomBlurRadius = 3 #3
kBloomBrightness = 3 #1.500

### Bloom blurry fraction
kBloomIntensity = 0.75 #0.000
### Radius of bloom blur
kBloomRadius = 15

### Bloom render target size as fraction of screen pixels
kBloomScale = 1.5 # 2.000
kBloomTonemap = 1 # 1
kBlurFactor = 2.0 # 0.500
kBlurMenuRadius = 20 # 15
kBlurMinDepth = 150 # 150.000

kCleanBackground = 0
kDefaultFontFile = "loaded.ttf" # "DroidSans.ttf"
kFallbackFontFile = "loaded.ttf" # "DroidSansFallback.ttf"
kLoadSuperFast = 1

kMonoFontFile = "Cousine-Regular.ttf" # "Cousine-Regular.ttf" # loaded.ttf is not console friendly

kParticleCountMax = 2097152 # 524288 # The program will hard cap you at a certain point

kPauseOnLostFocus = 0

kResolutionScale = 1.000 # 1.000 # set to 4 for gameboy mode

kStarColor = 0xa0ffffff
kStarColorVariation = 0.1 # 0.300
kStarInvDensity = 15000 # 900000.000
kStarNoiseScale = 0.001
kStarSizeRange = {20.000, 40.000}
kStarVertCount = 6
kStarZRange = {2000.000, 15000.000}

kTitleFontFile = "loaded.ttf" # "Dekar.ttf"

kSectorRoundEdges = 5 # for pentagon arena for beta


Attachments:
loaded.ttf.txt [16.8 KiB]
Downloaded 330 times
shaders.lua [14.01 KiB]
Downloaded 328 times

_________________
Graphics Overhaul Mod ver 2.0

Murderballs Faction Mod ver 1.2

Join us at our Reassembly Discord!


Last edited by Splinterman on Mon Mar 14, 2016 8:33 am, edited 4 times in total.

Sat Mar 12, 2016 7:14 pm
Profile
User avatar

Joined: Fri Jan 24, 2014 10:11 pm
Posts: 1295
Location: Ames, IA
Reply with quote
Can confirm shaders epic. the thruster trails helps me locate enemies too :D

_________________
The game where I originated as a member of this community. . VISUAL BASED MOD KIT!!
Shellcore command EP2


Sat Mar 12, 2016 8:14 pm
Profile
User avatar

Joined: Mon Oct 12, 2015 10:57 am
Posts: 304
Location: Canada
Reply with quote
k ty, going to do all of these except the CA.


Sat Mar 12, 2016 8:28 pm
Profile
Online
User avatar

Joined: Thu Feb 05, 2015 6:07 am
Posts: 365
Reply with quote
>mfw this mod

Image

_________________
Reassembly Web Dev Kit, by TTFTCUTS!

Muzzle Brake. Because not everyone is a fan of Noisy Crickets!

Empire of the Red Sun


Sat Mar 12, 2016 8:33 pm
Profile
User avatar

Joined: Tue Dec 22, 2015 9:44 pm
Posts: 668
Reply with quote
Mod page http://steamcommunity.com/sharedfiles/f ... =644263599 has now been updated to address some problems particularly with ship colors and chroma aberration

_________________
Graphics Overhaul Mod ver 2.0

Murderballs Faction Mod ver 1.2

Join us at our Reassembly Discord!


Sun Mar 13, 2016 6:47 am
Profile
User avatar

Joined: Tue Dec 22, 2015 9:44 pm
Posts: 668
Reply with quote
For anyone who downloaded my cvar file, be warned that "kLoadSuperFast = 1" was in there, which causes non-terran factions and spikey plants to not load correctly. I'll be taking down my cvar download for now.

_________________
Graphics Overhaul Mod ver 2.0

Murderballs Faction Mod ver 1.2

Join us at our Reassembly Discord!


Mon Mar 14, 2016 8:31 am
Profile

Joined: Tue Oct 13, 2015 12:44 am
Posts: 114
Reply with quote
i would be glad if, but i dont think there is one of my ships on the preview images


Sat Mar 19, 2016 12:56 pm
Profile
User avatar

Joined: Tue Dec 22, 2015 9:44 pm
Posts: 668
Reply with quote
Waste47 wrote:
i would be glad if, but i dont think there is one of my ships on the preview images


I think I put the dragonflies on there once, but every time I make a new version (it's been updated at least 5 times) I delete some of the old ones and bring in new ones, and I decided not to change the ship credits every time I change out my preview images. I might make a pic of your picard entries sometime though!

_________________
Graphics Overhaul Mod ver 2.0

Murderballs Faction Mod ver 1.2

Join us at our Reassembly Discord!


Sat Mar 19, 2016 1:12 pm
Profile

Joined: Tue Oct 13, 2015 12:44 am
Posts: 114
Reply with quote
Splinterman wrote:
Waste47 wrote:
i would be glad if, but i dont think there is one of my ships on the preview images


I think I put the dragonflies on there once, but every time I make a new version (it's been updated at least 5 times) I delete some of the old ones and bring in new ones, and I decided not to change the ship credits every time I change out my preview images. I might make a pic of your picard entries sometime though!



cool i like that my name ist mentioned in a steam mod :D


Sat Mar 19, 2016 2:02 pm
Profile

Joined: Wed Mar 14, 2018 8:11 am
Posts: 1
Reply with quote
Sorry if I just copy your code to the latest version(March 9th 2018 Update) of the game's shaders file and i don't know if there is any error/bug.

some of the code is missing in your shaders.lua when i compare the original file.
and I upload the modified file here.


Attachments:
shaders.lua [20.92 KiB]
Downloaded 259 times
Wed Mar 14, 2018 8:43 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 10 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software