Help needed to remove shadows using ImagePathFunctions

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
User avatar
pipapopinguin
Posts: 35
Joined: November 3rd, 2019, 10:36 am

Help needed to remove shadows using ImagePathFunctions

Post by pipapopinguin »

I've tried to remove the shadow using this code:

Code: Select all

 image={IMAGE}~RC(magenta>{COLOR})~ADJUST_ALPHA(formula="1 + (alpha - 30)")
 
and after that, if only the image had lost its shadow, i would just multiply the image to 255 alpha. problem is, that when i subtracted 30 from alpha, apperently the whole image vanished. I think I am using ADJUST_ALPHA wrong, altough im not sure.
Author of Corpse Mod 2, Breeze-Mod,Reflections and don't click here.
User avatar
pipapopinguin
Posts: 35
Joined: November 3rd, 2019, 10:36 am

Re: Help needed to remove shadows using ImagePathFunctions

Post by pipapopinguin »

yes this is btw in an macro
Author of Corpse Mod 2, Breeze-Mod,Reflections and don't click here.
User avatar
Celtic_Minstrel
Developer
Posts: 2166
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Help needed to remove shadows using ImagePathFunctions

Post by Celtic_Minstrel »

You are using ADJUST_ALPHA wrong.

Code: Select all

image="{IMAGE}~RC(magenta>{COLOR})~ADJUST_ALPHA(1 + (alpha - 30))"
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
pipapopinguin
Posts: 35
Joined: November 3rd, 2019, 10:36 am

Re: Help needed to remove shadows using ImagePathFunctions

Post by pipapopinguin »

Celtic_Minstrel wrote: June 28th, 2021, 1:35 pm You are using ADJUST_ALPHA wrong.

Code: Select all

image="{IMAGE}~RC(magenta>{COLOR})~ADJUST_ALPHA(1 + (alpha - 30))"
Okay that helps a bit, but HOW am I using ADJUST_ALPHA wrong, am I not using right "parameters" for it or am I just not needing it for my code i want to write?
Author of Corpse Mod 2, Breeze-Mod,Reflections and don't click here.
gnombat
Posts: 682
Joined: June 10th, 2010, 8:49 pm

Re: Help needed to remove shadows using ImagePathFunctions

Post by gnombat »

pipapopinguin wrote: June 28th, 2021, 5:56 pm

Code: Select all

1 + (alpha - 30)
Isn't that the same as alpha - 29? Is that really what you intended?

Maybe this is what you want?

Code: Select all

image="{IMAGE}~RC(magenta>{COLOR})~ADJUST_ALPHA(if(alpha = 255, 255, 0))"
User avatar
Celtic_Minstrel
Developer
Posts: 2166
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Help needed to remove shadows using ImagePathFunctions

Post by Celtic_Minstrel »

pipapopinguin wrote: June 28th, 2021, 5:56 pm Okay that helps a bit, but HOW am I using ADJUST_ALPHA wrong, am I not using right "parameters" for it or am I just not needing it for my code i want to write?
The error I spotted is that you wrote formula="some formula" inside ADJUST_ALPHA.

This might be a syntax error if WFL sees the double quotes, in which case the formula would return null which probably becomes 0 when the game tries to convert it to a number. I think WML parses out the quotes though, which would mean that WFL sees a valid formula: comparing a null value (the variable "formula", which doesn't exist) to the result of the formula you intended. Since your intended formula returns a number, it will never be equal to null, so that formula would return false which becomes 0 when the game tries to convert it to a number.

Either way, this explains why the image disappeared – your erroneous formula set the alpha to 0 everywhere).

I don't know if the formula itself was correct, though.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
pipapopinguin
Posts: 35
Joined: November 3rd, 2019, 10:36 am

Re: Help needed to remove shadows using ImagePathFunctions

Post by pipapopinguin »

Celtic_Minstrel wrote: June 29th, 2021, 3:44 am
pipapopinguin wrote: June 28th, 2021, 5:56 pm Okay that helps a bit, but HOW am I using ADJUST_ALPHA wrong, am I not using right "parameters" for it or am I just not needing it for my code i want to write?
The error I spotted is that you wrote formula="some formula" inside ADJUST_ALPHA.

This might be a syntax error if WFL sees the double quotes, in which case the formula would return null which probably becomes 0 when the game tries to convert it to a number. I think WML parses out the quotes though, which would mean that WFL sees a valid formula: comparing a null value (the variable "formula", which doesn't exist) to the result of the formula you intended. Since your intended formula returns a number, it will never be equal to null, so that formula would return false which becomes 0 when the game tries to convert it to a number.

Either way, this explains why the image disappeared – your erroneous formula set the alpha to 0 everywhere).

I don't know if the formula itself was correct, though.
I can work with that, thank you
Author of Corpse Mod 2, Breeze-Mod,Reflections and don't click here.
Post Reply