It is currently March 29th, 2024, 1:48 am

How to glow effect on visualizer

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to glow effect on visualizer

Post by balala »

Yincognito wrote: September 13th, 2020, 6:27 pm Oh, it's the same tool I used when creating my Sony Vegas plugin for scene detection in videos years ago: FFmpeg. The user will have to have the FFmpeg binaries, of course, but that's easy to download or even include in the @Resources folder, either as an address that the user can download or as the files themselves.
Ok, will give a try to them tomorrow.
However including an address and instructing the finaly user to download and use the app, well... this is not relly good. Including the file themselves seems a much better idea, however in this case the skin installer will have a .exe file, which again is debatable.
Yincognito wrote: September 13th, 2020, 6:27 pm and as for the audio part I don't think it'll have to be a WAV, if you don't rely on Rainmeter to play it (which would be incnvenient anyway, due to the limitations in that regard).
Agree, however this is what have I understood from your previous posts.
Yincognito wrote: September 13th, 2020, 6:27 pm Currently I'm more concerned about trivial Rainmeter code things that don't work as I want to in the prototype, rather than making the whole process work, LOL. In other words, the Rainmeter code is giving me more problems than strictly extracting and playing the bitmap. :D
Why? What is the problem?
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: How to glow effect on visualizer

Post by Yincognito »

balala wrote: September 13th, 2020, 7:07 pmHowever including an address and instructing the finaly user to download and use the app, well... this is not relly good. Including the file themselves seems a much better idea, however in this case the skin installer will have a .exe file, which again is debatable.
Yeah, well, it's debatable either way. But since Rainmeter doesn't provide the capability and this approach makes it possible in an easy to understand way, I guess it will be the decision of the user if he wants to take advantage of it or not. After all, Rainmeter already can use 3rd party plugins, executables and such to boost its range of capabilities, so from this point of view it's a non issue. Not much difference in using, say, RainRGB.exe to have the color choosing capability in Rainmeter and this, right? In my view this is a much more attractive feature, assuming it will work well and have as few drawbacks as possible. :confused:
balala wrote: September 13th, 2020, 7:07 pmWhy? What is the problem?
I don't know if I should continue to be off topic here in this thread, I think the approach should have its own thread, where ideally folks like me, you, eclectic-tech, SilverAzide, jsmorley and others can add their ideas and suggestions to make it a collaborative effort, the way parsing weather.com has been. The reasoning is simple: more eyes and more brains on the matter would make the result better. I will start such a thread somewhere on the forum these days, but I'll have to have a working prototype first in order to do that. I can however send you what I have at the moment in a PM, if you want - the issue is that in using 2 image files as buffers, everything works well except that a single frame is taken from the wrong file, probably because of the order of operations or missing updating a measure or a meter. Let me know if you want me to send you what I have so far.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to glow effect on visualizer

Post by balala »

Yincognito wrote: September 13th, 2020, 8:04 pm Yeah, well, it's debatable either way. But since Rainmeter doesn't provide the capability and this approach makes it possible in an easy to understand way, I guess it will be the decision of the user if he wants to take advantage of it or not. After all, Rainmeter already can use 3rd party plugins, executables and such to boost its range of capabilities, so from this point of view it's a non issue. Not much difference in using, say, RainRGB.exe to have the color choosing capability in Rainmeter and this, right? In my view this is a much more attractive feature, assuming it will work well and have as few drawbacks as possible. :confused:
Right. Finally being your work, it's up to you, I think.
Yincognito wrote: September 13th, 2020, 8:04 pm I don't know if I should continue to be off topic here in this thread, I think the approach should have its own thread, where ideally folks like me, you, eclectic-tech, SilverAzide, jsmorley and others can add their ideas and suggestions to make it a collaborative effort, the way parsing weather.com has been. The reasoning is simple: more eyes and more brains on the matter would make the result better. I will start such a thread somewhere on the forum these days, but I'll have to have a working prototype first in order to do that. I can however send you what I have at the moment in a PM, if you want - the issue is that in using 2 image files as buffers, everything works well except that a single frame is taken from the wrong file, probably because of the order of operations or missing updating a measure or a meter. Let me know if you want me to send you what I have so far.
Alright, start it and let us see what have you acieved. I'm definitely interested...
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: How to glow effect on visualizer

Post by Yincognito »

balala wrote: September 13th, 2020, 8:17 pm Right. Finally being your work, it's up to you, I think.

Alright, start it and let us see what have you acieved. I'm definitely interested...
I sent you a PM, enjoy playing with it. Not necessarily tonight, tomorrow it's a good day for that as well. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
AnryuKen
Posts: 18
Joined: September 1st, 2020, 10:18 pm

Re: How to glow effect on visualizer

Post by AnryuKen »

Yincognito wrote: September 11th, 2020, 3:08 pm Normally, if the meters were Shapes, things would have been easier, I think, since one can use radial gradients there, like I mentioned in my previous reply to balala. However, since the meters are Roundlines and only a single "normal" color can be specified in its LineColor option, not to mention we deal with Lua here which automatically writes to the .inc files, we must use only the tools that we have at our disposal.

First, make a backup of your current settings in VisBubble, as we're going to modify some files.
Next, paste this into your Factory.lua script, replacing its contents:

Code: Select all

-- @author Malody Hoe / GitHub: undefinist / Twitter: undefinist
-- Structure of Script Measure:
---- IncFile=
---- Number=
---- SectionName=
---- OptionN=
---- ValueN=
---- where N is an ordered number from 0
-- Use %% to substitute it as the iteration number (which is specified by the Number option)
---- For example, if you specify 10, it will create 10 sections and replace the first section's %%
---- with 0, the second section's %% with 1, etc...
-- Wrap any formulas you want to parse in {} that otherwise RM would treat as a string
---- For example, [Measure{%%+1}] will have this script parse it for you

function Initialize()
	local num = SELF:GetNumberOption("Number")
	local GsectionName = SELF:GetOption("GSectionName")
	local sectionName = SELF:GetOption("SectionName")

	local file = io.open(SKIN:MakePathAbsolute(SELF:GetOption("IncFile")), "w")

	local t = { "; auto-generated by " .. SELF:GetName() }

	for i = 0, num-1 do

		table.insert(t, "[" .. doSub(GsectionName, i) .. "]")
		local j = 0

		while true do
			local opt = SELF:GetOption("GOption" .. j)
			if opt == "" then
				break
			end
			table.insert(t, opt .. "=" .. doSub(SELF:GetOption("GValue" .. j), i))
			j = j + 1
		end

		table.insert(t, "[" .. doSub(sectionName, i) .. "]")
		local j = 0

		while true do
			local opt = SELF:GetOption("Option" .. j)
			if opt == "" then
				break
			end
			table.insert(t, opt .. "=" .. doSub(SELF:GetOption("Value" .. j), i))
			j = j + 1
		end

	end

	file:write(table.concat(t, "\n"))
	file:close()
end

-- does all the substitution!
function doSub(value, i)
	return value:gsub("%%%%", i):gsub("{.-}", parseFormula)
end

-- sub to remove {the curly braces}, then add (parentheses), then parse it
function parseFormula(formula)
	return SKIN:ParseFormula("(" .. formula:sub(2, -2) .. ")")
end
This allows specifying 2 sets of [Section] and Key=Value parts that Factory.lua will write into your Lines.inc file, instead of just one. Therefore, we're now able to create some sort of a "duplicate" Roundline meter for each normal meter in Lines.inc - and those duplicates, starting with "G" (from "glow") are going to be our glow simulation.

Next, paste the following into your BarExtrude.ini, replacing its contents:

Code: Select all

[Metadata]
Name=VisBubble
Author=undefinist
Version=3.1
License=CC BY-NC-SA 3.0
Information=The default | Double-click for settings.

[Rainmeter]
Update=25
ContextTitle=SETTINGS (double-click)
ContextAction=[!ActivateConfig "#ROOTCONFIG#\SettingsWindow"]
ContextTitle2=SETTINGS FILE
ContextAction2=["#ROOTCONFIGPATH#Settings.inc"]

[Variables]
@Include=Settings.inc
FORMULA_SUM=([mBand%%]+(#Smoothing#=0?0:(%%={#NumOfItems#-1}?0:[mBand{(%%+1)%#NumOfItems#}])+(%%=0?0:[mBand{%%=0?#NumOfItems#-1:%%-1}])))
FORMULA_SUM_FULL=([mBand%%]+(#Smoothing#=0?0:[mBand{(%%+1)%#NumOfItems#}]+[mBand{%%=0?#NumOfItems#-1:%%-1}]))
FORMULA_AVG_NUM=((%%={#NumOfItems#-1}||%%=0)?2:3)
FORMULA_AVG_NUM_FULL=3
FORMULA_AVG=#FORMULA_SUM_FULL#/#FORMULA_AVG_NUM_FULL#
FORMULA_THETA=(#AngleTotal#-#AngleTotal#/#NumOfItems#*(#ClockWise#=0?%%:#NumOfItems#-%%-1)+#AngleStart#)
@Include2=#INC#Common.inc
GlowColor=0,0,0,0

[mFullCircle]
Measure=Calc
IfCondition=#AngleTotal# >= PI * 2
IfTrueAction=[!WriteKeyValue Variables FORMULA_AVG "#*FORMULA_SUM_FULL*#/#*FORMULA_AVG_NUM_FULL*#"]
IfFalseAction=[!WriteKeyValue Variables FORMULA_AVG "#*FORMULA_SUM*#/#*FORMULA_AVG_NUM*#"]
UpdateDivider=-1

[mGlowColor]
Measure=String
String=#ItemColor#
UpdateDivider=-1
RegExpSubstitute=1
Substitute="(\d+)$":"32"
OnUpdateAction=[!SetVariable GlowColor "[mGlowColor]"]
DynamicVariables=1

;=
; base measures
;============================

[mAudioOut]
Bands=(#NumOfItems#+4)

;=
; meterstyles
;============================

[styleGlow]
LineColor=#GlowColor#
LineWidth=(#ItemWidth#*3)
RotationAngle=(#Inward#*PI)
ControlAngle=0
AntiAlias=1
DynamicVariables=1

[styleLine]
LineColor=#ItemColor#
LineWidth=(#ItemWidth#/2)
RotationAngle=(#Inward#*PI)
ControlAngle=0
AntiAlias=1
DynamicVariables=1

;=
; meters + scripts + includes
;============================

[sFactoryBandMeasures]
Measure=Script
ScriptFile=#SCRIPT#Factory.lua
IncFile=#INC#BandMeasures.inc
Number=#NumOfItems#
SectionName=mBand%%
Option0=Measure
Value0=Plugin
Option1=Plugin
Value1=AudioLevel
Option2=Parent
Value2=mAudioOut
Option3=Type
Value3=Band
Option4=BandIdx
Value4={%%+1}
UpdateDivider=-1
@Include=#INC#BandMeasures.inc

[sFactoryBars]
Measure=Script
ScriptFile=#SCRIPT#Factory.lua
IncFile=#INC#Lines.inc
Number=#NumOfItems#

SectionName=%%
Option0=Meter
Value0=Roundline
Option1=MeterStyle
Value1=styleLine
Option2=StartAngle
Value2={#FORMULA_THETA#}
Option3=X
Value3={#Radius#*Cos(#FORMULA_THETA#%(PI*2))+#Radius#+#ExtrudeMax#}
Option4=Y
Value4={#RadiusY#*Sin(#FORMULA_THETA#%(PI*2))+#RadiusY#+#ExtrudeMax#}
Option5=LineLength
Value5=((#FORMULA_AVG#=0)?{#ExtrudeMin#=0?-1:#ExtrudeMin#}:((#FORMULA_AVG#-[mBand%%])*{#Smoothing#}+[mBand%%])*{#ExtrudeMax#-#ExtrudeMin#}+#ExtrudeMin#)
Option6=DynamicVariables
Value6=1

GSectionName=G%%
GOption0=Meter
GValue0=Roundline
GOption1=MeterStyle
GValue1=styleGlow
GOption2=StartAngle
GValue2={#FORMULA_THETA#}
GOption3=X
GValue3={#Radius#*Cos(#FORMULA_THETA#%(PI*2))+#Radius#+#ExtrudeMax#}
GOption4=Y
GValue4={#RadiusY#*Sin(#FORMULA_THETA#%(PI*2))+#RadiusY#+#ExtrudeMax#}
GOption5=LineLength
GValue5=((#FORMULA_AVG#=0)?{#ExtrudeMin#=0?-1:#ExtrudeMin#}:((#FORMULA_AVG#-[mBand%%])*{#Smoothing#}+[mBand%%])*{#ExtrudeMax#-#ExtrudeMin#}+#ExtrudeMin#)
GOption6=DynamicVariables
GValue6=1

UpdateDivider=-1
@Include=#INC#Lines.inc

; Helper script to always refresh skin twice instead of once
; This is so that it loads the updated .inc files
[sRefresher]
Measure=Script
ScriptFile=#SCRIPT#Refresher.lua
UpdateDivider=-1
Refreshed=0

[sColor]
Measure=Script
ScriptFile=#SCRIPT#Color.lua
UpdateDivider=-1
NumOfItems=#NumOfItems#
Color=#ItemColor#
;C4FB7200:0|C4FB72cc:30|85ECF099:60|85ECF099:80|85ECF000
This modifies the Alpha value (i.e. the adjustable transparency, currently being set to 32 in [mGlowColor]) of #ItemColor# and stores the result into the #GlowColor# variable. A new style named [styleGlow] is created to apply it to the future "glow Roundline meters", where, beside the use of #GlowColor#, the LineWidth of the Roundline is increased by a factor of 3. Finally, the glow meters are created by adding the "G....." options to [sFactoryBars], taking advantage of the fact that we modified the Factory.lua script beforehand to write another meter before each original one.

This doesn't look as good as a gradient glow, but it's a start - if anyone else has a better idea on how to do this, feel free to share your thoughts.
Hi, firstly I apologize for not checking the thread earlier, I got busy with online classes. I'd like to thank you a lot for helping and replying, the outcome opens up a lot of ideas that I could use in future suites I might make :). Regarding my original problem though, the variant from VisBubble I'm actually using are two WaveFilled. They basically have no shape I guess? Would this code work on that too?
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: How to glow effect on visualizer

Post by Yincognito »

AnryuKen wrote: September 21st, 2020, 3:02 am Hi, firstly I apologize for not checking the thread earlier, I got busy with online classes. I'd like to thank you a lot for helping and replying, the outcome opens up a lot of ideas that I could use in future suites I might make :). Regarding my original problem though, the variant from VisBubble I'm actually using are two WaveFilled. They basically have no shape I guess? Would this code work on that too?
Well, you should have mentioned the variant you were using when posting the question - I mean, it doesn't take a lot of thought to realize the solutions differ from variant to variant, does it? Anyway, to get to the point, although the variant you're loading uses the same Factory.lua to generate the band measures, it also uses an additional - and more complex - Wave.lua script to draw the shape. I already stepped into Lua territory to try to help, but for this one I think I'll let someone who actually knows Lua (if any, LOL) to answer it ... although I'm not sure they'll bite the bullet.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth