Additional Shaders

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Additional Shaders

Postby Mav3r1ck » Thu May 07, 2020 3:14 pm

I want to add extra shaders for warping textures/flats called "warp3" and "warp4" but I get a bad syntax error when booting up the game.

How do I properly add extra warps to the game?
User avatar
Mav3r1ck
 
Joined: 17 Jul 2015

Re: Additional Shaders

Postby MFG38 » Sat May 09, 2020 5:22 am

Post your code. The problem will be easier to diagnose that way.
User avatar
MFG38
 
Joined: 14 Apr 2019
Location: Finland
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)

Re: Additional Shaders

Postby Mav3r1ck » Sat May 09, 2020 6:58 am

Alright, here are the codes that replace WARP and WARP2.

WARP
Code: Select allExpand view
uniform float timer;

vec4 Process(vec4 color)
{
   vec2 texCoord = gl_TexCoord[0].st;

   const float pi = 3.14159265358979323846;
   vec2 offset = vec2(0,0);

   offset.y = sin(pi * 10.0 * (texCoord.x + timer * 0.125)) * 0.1;
   offset.x = sin(pi * 10.0 * (texCoord.y + timer * 0.125)) * 0.1;

   texCoord += offset;

   return getTexel(texCoord) * color;
}


WARP2
Code: Select allExpand view
uniform float timer;

vec4 Process(vec4 color)
{
   vec2 texCoord = gl_TexCoord[0].st;

   const float pi = 3.14159265358979323846;
   vec2 offset = vec2(0.0,0.0);

   float siny = sin(pi * 10.0 * (texCoord.y * 1.0 + timer / 2.0 * 0.45)) * 0.03;
   offset.y = siny + sin(pi * 10.0 * (texCoord.x * 1.0 + timer / 2.0 * 0.75)) * 0.03;
   offset.x = siny + sin(pi * 10.0 * (texCoord.x * 1.0 + timer / 2.0 * 0.45)) * 0.02;

   texCoord += offset;

   return getTexel(texCoord) * color;
}


The above shaders were made by another community member and I wanted to add them as additional shaders called "WARP3" and "WARP4" for textures/flats instead of it having to replace the existing "WARP" and "WARP2"

However, when I boot up the game I get a bad syntax error.
User avatar
Mav3r1ck
 
Joined: 17 Jul 2015

Re: Additional Shaders

Postby _mental_ » Sat May 09, 2020 8:05 am

Sharers are correct, the problem is somewhere else. Please post a runnable sample along with the exact error message.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Additional Shaders

Postby Mav3r1ck » Sat May 09, 2020 8:27 am

Here is an example PK3. It includes the shaders that have been renamed into "func_warp3" and "func_warp4" rather than "func_warp1" and "func_warp2".

This also includes an animdefs that have flats using "WARP4". Just having the flats use "WARP4" causes the error.

Code: Select allExpand view
Execution could not continue

Script error "Resurgence.pk3:animdefs.txt" line 235:
Bad syntax
You do not have the required permissions to view the files attached to this post.
User avatar
Mav3r1ck
 
Joined: 17 Jul 2015

Re: Additional Shaders

Postby _mental_ » Sat May 09, 2020 9:17 am

Custom shaders have nothing to do with ANIMDEFS. Its WARP and WARP2 are reserved keywords, not lump names.
You need to assign shaders to textures inside GLDEFS lump.
_mental_
 
 
 
Joined: 07 Aug 2011


Return to Assets (and other stuff)

Who is online

Users browsing this forum: No registered users and 1 guest