Welcome, Guest
Username Password: Remember me

TOPIC: Documentation for developing Lightworks effects (Post # 1 contains summary links)

Re: The future for Lightworks user effects 1 year, 9 months ago #192083

  • jwrl
  • Moderator
    Pro User
  • OFFLINE
  • Moderator
  • Posts: 13072
  • 1 year, 9 months ago
A quick glance at those shaders suggests that they rely on calls to internal Autodesk functions. The possibility of porting them to Lightworks seems extremely slight, but if you want to attempt it, feel free.

For what it's worth the few that I have looked at offer effects that are already available in Lightworks, but there may be others that I haven't checked out that extend the effects here in some way.
Last Edit: 1 year, 9 months ago by jwrl.

Re: The future for Lightworks user effects 1 year, 9 months ago #192085

  • lghtwrks
  • OFFLINE
  • Platinum Boarder
  • Posts: 3333
  • 1 year, 9 months ago
MBS > OFX > lwks ,)

Re: The future for Lightworks user effects 1 year, 9 months ago #192087

  • schrauber
  • Pro User
  • OFFLINE
  • Platinum Boarder
  • Posts: 4577
  • 1 year, 9 months ago
Although the following test effect is not a solution to the export problem, it may be interesting in this context if very poor material was imported.
This effect automatically selects the areas that should be blurred due to similar RGB values. An attempt is made to leave unchanged areas in which adjacent pixels have stronger RGB differences.
Edit: So far, the test effect calculates the blur intensity only from the red values of nearby pixels. That still needs to be improved, and much else.
But in this example it is a significant improvement:
This attachment is hidden for guests. Please log in or register to see it.



The slider name "Difference" means the threshold value of RGB differences, from which one should not blur. The value 1 corresponds to the gradation of 8-bit RGB.

However, with good imported material, but bad export, the effect is of course pointless.

The test effect, which still has weaknesses:
This attachment is hidden for guests. Please log in or register to see it.

Unfortunately, I have not yet come to translate the German-language code comments.
Mainly automatically translated
--------------------------------------------
Software: Lightworks 2020.1.1; || Windows 10 Home 1909, 64 Bit
Hardware: Intel i5-4440 (3,1 GHz); || RAM: 8 GB; || Intel HD Graphics 4600 (can use max. 2 GB of shared RAM)
Last Edit: 1 year, 9 months ago by schrauber.

Re: The future for Lightworks user effects 1 year, 9 months ago #192177

  • hugly
  • OFFLINE
  • Platinum Boarder
  • Posts: 26290
  • 1 year, 9 months ago
That for all the input.

Schrauber, the result of your effect looks nice in the demo. Google should buy, automate and apply it to their crappy encodes. Don't forget the copyright.

By the way, I hope that Youtube and Vimeo presets will be significantly improved with next release for quality with a wide range of material and not for some obscure Youtube delivery specs. And, h.264/MP4 (Free) should get some sliders to adjust bitrate. The limit to 720p is enough, it doesn't need bad encoding results on top.
It's better to travel well than to arrive...
Last Edit: 1 year, 9 months ago by hugly.

Re: The future for Lightworks user effects 1 year, 9 months ago #192251

  • schrauber
  • Pro User
  • OFFLINE
  • Platinum Boarder
  • Posts: 4577
  • 1 year, 9 months ago
Back to the basics for effect development:

I tested the Intrinsic Function tanh with the Curve Tracer effect.
Because I also wanted to use tanh for very steep S-curves, it was important to me to determine the permissible limit for the tanh parameter.
The result is a detailed documentation with graphics, videos, and the macro TANH, which improved my reliability test considerably. However, it could only test on my system.

Here are some detailed documented S-curves - code, which are based on tanh. I assigned different names to the curves. If we use this code with the same name as sub-code in effects, the GitHub search function will find the corresponding documentation.

So far, however, I have only used a few cosine-based curves in my effects.



More:
- General basic information
- Overview page of the developer repository
Mainly automatically translated
--------------------------------------------
Software: Lightworks 2020.1.1; || Windows 10 Home 1909, 64 Bit
Hardware: Intel i5-4440 (3,1 GHz); || RAM: 8 GB; || Intel HD Graphics 4600 (can use max. 2 GB of shared RAM)

Re: The future for Lightworks user effects 1 year, 9 months ago #192262

  • jwrl
  • Moderator
    Pro User
  • OFFLINE
  • Moderator
  • Posts: 13072
  • 1 year, 9 months ago
I noted your version of the template there. I have been remiss - mine has undergone significant changes which I haven't posted. The header in my template now looks like this.

// @Maintainer [Optional]
// @Released [Required]
// @Author [Required - repeat if more than one author]
// @Created [Required]
// @see [PNG or JPEG screen grab - repeat for more images or MP4 examples of use]

/**
 PLACE DESCRIPTION HERE USING AS MANY LINES AS NECESSARY
*/

//-----------------------------------------------------------------------------------------//
// Lightworks user effect MyEffect.fx
//
// PLACE REVISION HISTORY HERE
//-----------------------------------------------------------------------------------------//

int _LwksEffectInfo
<
   string EffectGroup = "GenericPixelShader";
   string Description = "...";
   string Category    = "...";
   string SubCategory = "...";
   string Notes       = "...";
> = 0;

You will see that format in every effect of mine and most of the other user effects in Lightworks User effects.
Last Edit: 1 year, 9 months ago by jwrl.

Re: The future for Lightworks user effects 1 year, 9 months ago #192272

  • schrauber
  • Pro User
  • OFFLINE
  • Platinum Boarder
  • Posts: 4577
  • 1 year, 9 months ago
Mainly automatically translated
--------------------------------------------
Software: Lightworks 2020.1.1; || Windows 10 Home 1909, 64 Bit
Hardware: Intel i5-4440 (3,1 GHz); || RAM: 8 GB; || Intel HD Graphics 4600 (can use max. 2 GB of shared RAM)

Re: The future for Lightworks user effects 1 year, 9 months ago #192278

  • jwrl
  • Moderator
    Pro User
  • OFFLINE
  • Moderator
  • Posts: 13072
  • 1 year, 9 months ago
I also have an additional simple piece of code that forces a compiler error if the effect is compiled in a version earlier than 14.5. Here it is.

#ifndef _LENGTH   // Only available in version 14.5 and up
Bad_LW_version    // Forces a compiler error if the Lightworks version is bad.
#endif

So far I haven't included it in any effects that I've released, but it works reliably to force a compiler failure with the error message error X3000: unrecognised identifier 'Bad_LW_version'. I feel that it's a reasonably reliable way of handling attempts to compile newer effects in older versions of Lightworks, while giving an error message that actually means something.

[EDIT] By the way, never include that code block until you have fully developed your effect. It can affect the compiler's behaviour in odd ways. I spent a morning a while ago trying to work out why an additional parameter in an effect that I was developing appeared to do nothing. Commenting out that block and restarting Lightworks fixed the problem. Reinstating the code caused problems during development again.

Of course, once the effect is fully developed it works as planned with that code in place.
Last Edit: 1 year, 9 months ago by jwrl.

Re: The future for Lightworks user effects 1 year, 9 months ago #192289

  • schrauber
  • Pro User
  • OFFLINE
  • Platinum Boarder
  • Posts: 4577
  • 1 year, 9 months ago
Thanks, in my effect "RC3001_LW14_5.fx" I have used an almost identical code:

//--------------------------------------------------------------//
// Compatibility check, and build a meaningful compiler warning
//--------------------------------------------------------------//

#ifndef _LENGTH
   THIS_EFFECT_REQUIRES_LIGHTWORKS_14_5_OR_BETTER
#endif
Mainly automatically translated
--------------------------------------------
Software: Lightworks 2020.1.1; || Windows 10 Home 1909, 64 Bit
Hardware: Intel i5-4440 (3,1 GHz); || RAM: 8 GB; || Intel HD Graphics 4600 (can use max. 2 GB of shared RAM)

Re: The future for Lightworks user effects 1 year, 8 months ago #192364

  • schrauber
  • Pro User
  • OFFLINE
  • Platinum Boarder
  • Posts: 4577
  • 1 year, 8 months ago
Technical details to the unexpected results of the fireball effect without input.

This effect uses only one internal render input:

//-----------------------------------------------------------------------------------------//
// Inputs
//-----------------------------------------------------------------------------------------//

texture Inp : RenderColorTarget;

//-----------------------------------------------------------------------------------------//
// Samplers
//-----------------------------------------------------------------------------------------//

sampler s_Input = sampler_state
{
   Texture   = <Inp>;
   AddressU  = ClampToEdge;
   AddressV  = ClampToEdge;
   MinFilter = Linear;
   MagFilter = Linear;
   MipFilter = Linear;
};



As far as I know, only true inputs that are connected in the routing provide data about the texture coordinates used, but not such internal inputs.
github.com/FxSchrauber/Code_for_developing_Lightworks_effects/blob/master/Basics/Inputs.md


The second shader "ps_main" uses TEXCOORD1.
float4 ps_main (float2 uv : TEXCOORD1) : COLOR

Because there is no real input, TEXCOORD1 does not exist or assumes random values.
Therefore I assume that this shader uses undefined coordinates.
I assume that only TEXCOORD0 is defined, but strangely enough this causes problems with your GPU.

Also, when rendering internally with TEXCOORD0, there is the problem that the internal sampler "s_Input" needs coordinates corresponding to the pixel center (Windows), which is up to half a texel different from TEXCOORD0.
This was also the problem with some of my effects that I could only use a single shader pass without a real input connected to the routing because no precise texture coordinates were available for the sampler.

---

However, I'm surprised that you saw this 1 pixel vertical line when TEXCOORD0 is not used for a sampler, but only within a shader to create graphical elements.
The use of multiple texture coordinates in one shader (including TEXCOORD0) is also standard for official Lightworks effects.
If that is the case, then such a fundamental question would be worth a thorough investigation.
Maybe the real problem is different, and is only obscured by the slightly different coordinates provided by TEXCOORD1?

Brainstorming:

- Does it only occur with PROFILE ps_3_0 ?

- Does it depend on effect settings or project format settings ?

- Did it also occur with other effects; if yes, were there similarities in the codes ?

- Are there problems with critical parameter values of atan2 ?
I'm not sure how to understand that; Cg 3.1 Reference Manual:
DESCRIPTION
atan2 calculates the arctangent of y/x. atan2 is well defined for every point other than the origin, even if x equals 0 and y does not equal 0.
Mainly automatically translated
--------------------------------------------
Software: Lightworks 2020.1.1; || Windows 10 Home 1909, 64 Bit
Hardware: Intel i5-4440 (3,1 GHz); || RAM: 8 GB; || Intel HD Graphics 4600 (can use max. 2 GB of shared RAM)
Last Edit: 1 year, 8 months ago by schrauber.

Re: The future for Lightworks user effects 1 year, 8 months ago #192377

  • schrauber
  • Pro User
  • OFFLINE
  • Platinum Boarder
  • Posts: 4577
  • 1 year, 8 months ago
jwrl wrote:
I also have an additional simple piece of code that forces a compiler error if the effect is compiled in a version earlier than 14.5.

I added it to the developer repository
Code ID: Version14_5_check
With this ID visible in the code, the code documentation can be found with the GutHub search (or on the local drive).
Mainly automatically translated
--------------------------------------------
Software: Lightworks 2020.1.1; || Windows 10 Home 1909, 64 Bit
Hardware: Intel i5-4440 (3,1 GHz); || RAM: 8 GB; || Intel HD Graphics 4600 (can use max. 2 GB of shared RAM)

Re: The future for Lightworks user effects 1 year, 8 months ago #192378

  • jwrl
  • Moderator
    Pro User
  • OFFLINE
  • Moderator
  • Posts: 13072
  • 1 year, 8 months ago
schrauber wrote:
Are there problems with critical parameter values of atan2 ?
I'm not sure how to understand that; Cg 3.1 Reference Manual:

DESCRIPTION
atan2 calculates the arctangent of y/x. atan2 is well defined for every point other than the origin, even if x equals 0 and y does not equal 0.

I understand that to mean that the origin must be NAN (not a number), since tan (0) is infinite. In practice, NAN usually seems to be treated in shaders as if it's the next nearest legal value. That could be the cause of the problem though.

For what it's worth, when I drag the fireball around on the screen it behaves as expected. However an effect that behaves in one way on one system and in quite another on a second cannot be released. I will withdraw it until I can determine the cause of the problem and fix it.

I have an older system that doesn't have a Quadro GPU that might show the problem. I'll fire it up later today and see if I can duplicate what you're seeing.

jwrl wrote:
A quick glance at those shaders suggests that they rely on calls to internal Autodesk functions. The possibility of porting them to Lightworks seems extremely slight

It looks like I was right to say that, doesn't it?
Last Edit: 1 year, 8 months ago by jwrl.

Re: The future for Lightworks user effects 1 year, 8 months ago #192382

  • schrauber
  • Pro User
  • OFFLINE
  • Platinum Boarder
  • Posts: 4577
  • 1 year, 8 months ago
Thank you,

Just to prevent misunderstandings:
My considerations regarding atan2 related to the phenomenon you observed that was caused by the file I modified.
This image is hidden for guests. Please log in or register to see it.
Mainly automatically translated
--------------------------------------------
Software: Lightworks 2020.1.1; || Windows 10 Home 1909, 64 Bit
Hardware: Intel i5-4440 (3,1 GHz); || RAM: 8 GB; || Intel HD Graphics 4600 (can use max. 2 GB of shared RAM)
Last Edit: 1 year, 8 months ago by schrauber.

Re: The future for Lightworks user effects 1 year, 8 months ago #192383

  • jwrl
  • Moderator
    Pro User
  • OFFLINE
  • Moderator
  • Posts: 13072
  • 1 year, 8 months ago
That's exactly what I'm working on, and I have found the fix. I have been testing it exhaustively on both my systems, and it seems reliable as far as I can see. It seems to have been caused by the half texel offset of TEXCOORD0 working in opposite directions either side of centre.

The fix is to limit the x and y values to a predetermined minimum value as they approach zero (centre) from either positive or negative values. This should mean that atan2() is never presented with an illegal value. While this could add a little extra flicker around the centre X axis with the higher resolution formats, that should be no big deal.

You can try it yourself if you still have the original version. Simply do this.

#define MINIMUM 0.00001

float4 ps_main (float2 uv : TEXCOORD0) : COLOR
{
   float2 xy = float2 ((uv.x - PosX) * _OutputAspectRatio, 1.0 - uv.y - PosY);

   xy /= max (Size * 5.0, MINIMUM);

   if (abs (xy.x) < MINIMUM) xy.x = MINIMUM;

   if (abs (xy.y) < MINIMUM) xy.y = MINIMUM;

...

I have also optimised the code in the main loop so that it doesn't need to do pow() operations. Inside the loop there are now just two additions and a multiplication. When I'm completely satisfied that it works I'll post it, but I have a little further testing that I need to do before I'll lock it off.
Last Edit: 1 year, 8 months ago by jwrl.

Re: The future for Lightworks user effects 1 year, 8 months ago #192384

  • schrauber
  • Pro User
  • OFFLINE
  • Platinum Boarder
  • Posts: 4577
  • 1 year, 8 months ago
Interesting.

jwrl wrote:
... You can try it yourself if you still have the original version. Simply do this.

I could do that, but on my system I never saw the vertical line you observed.
Mainly automatically translated
--------------------------------------------
Software: Lightworks 2020.1.1; || Windows 10 Home 1909, 64 Bit
Hardware: Intel i5-4440 (3,1 GHz); || RAM: 8 GB; || Intel HD Graphics 4600 (can use max. 2 GB of shared RAM)
Last Edit: 1 year, 8 months ago by schrauber.
Time to create page: 0.49 seconds
Scroll To Top