Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
69 user(s) are online (53 user(s) are browsing Forums)

Members: 0
Guests: 69

more...

Support us!

Headlines

 
  Register To Post  

« 1 ... 15 16 17 (18) 19 20 21 ... 24 »
Re: Shaderjoy 1.17
Not too shy to talk
Not too shy to talk


See User information
@kas1e
@Capehill
Quote:
Rechecked all the shaders which give me errors about "no matching overloaded function found", and for the "min", "max" and "round" they are gone. Through found one shader, which still brings error about "rot":
https://www.shadertoy.com/view/3dVyD3


I didn't even know that something like this "rot" function exists in GLSL and I didn't spot it on the official khronos reference pages so far.
To me it just looks like a shortcut to create a rotation matrix, so:

rot(X) = mat2(cos(X),-sin(X),sin(X),cos(X))
or
#define rot(X) mat2(cos(X),-sin(X),sin(X),cos(X))

And indeed, the shader behaves identical if you replace rot(X) by the equivalent mat2 sequence from above.
Therefore, as a simple quick workaround, Capehill could add this define into his constant shader prefix. On the other hand, "rot" sounds like sth. people would use quite often, so that workaround could result in problems with other shaders then. If you add it, maybe better make it a function instead of a define.

Or simply ignore this failing shader and leave everything as is, probably the best idea after all.

Go to top
Re: Shaderjoy 1.17
Home away from home
Home away from home


See User information
@Daniel
About "rot": all fine, it was just me who takes a shader containing 3 sub shaders : common (with 'rot' defined), mainiamge one, and bufferA (which both use this 'rot'). But when I check it, I just take the whole common part and put to mainimage shader, and bufferA can't find it of course.

So no worry, that just by an error in the end :)

As for this HW_PERFORMANCE warning. If I just do :

#ifdef HW_PERFORMANCE

instead of

#if HW_PERFORMANCE==0

Then warning still here.

But if i put his forgotten define as you say:

#ifndef HW_PERFORMANCE
#define HW_PERFORMANCE 0
#endif

Then all fine :)

So no action needs to be taken for anything, thanks for worry!

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Shaderjoy 1.17
Home away from home
Home away from home


See User information
@Capehill
Find out interesting moments about multipass shaders.

Take that one as an example:

https://www.shadertoy.com/view/XsG3z1

Now, that what i do:

1). dbl-click on image.frag
2). RMB->Channels->BufferA->New
3). drop bufferA.frag to active bufferA tab.
4). RMB->Channels->Load Ichannel0 : set there BufferA
5). RMB->Channels->BufferA->Load Ichannel0: set there BufferA as well.

Now, the effect didn't show as expected. But, if I press "Compile", then it starts to works.

But so far we have "auto-compile" when we add anything to the shaderjoy, right? If so, it may be some unexpected behavior I found and after I set the last settings for BufferA, it should auto-compiles ?

Probably, things should "auto compiles" all the time when you add any channel to any buffer or main image. (at least that will be good, imho)

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Shaderjoy 1.17
Home away from home
Home away from home


See User information
@Capehill

Another issue is when you create more buffers than just BufferA via "new", then they not auto-active.

I.e. for example take any multipass shader which has many buffers, like this one: https://www.shadertoy.com/view/MsG3Dz

Now, open the image. frag. All ok, it's active. Then RMB->BufferA->New. bufferA creates and active, so I can d&d bufferA.frag to it. All fine.

But then, RMB->BufferB->New, and while BufferB creates, it not active (while should). Instead BufferA still active.

So bug probably that autoactivation of tabs happens only for BufferA, but not for BufferB,C and D.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Shaderjoy 1.17
Just can't stay away
Just can't stay away


See User information
@kas1e

Quote:

Another issue is when you create more buffers than just BufferA via "new", then they not auto-active.


I think there isn't any implementation to activate specific tab so it should be the default clicktab.gadget behaviour (first tab activated?). Probably can be improved.

Go to top
Re: Shaderjoy 1.17
Home away from home
Home away from home


See User information
@CApehill
Sorry to a bit derailing topic back on first pages from half of year ago, but just want a bit to inform Sonic about his shaders which he uploads before as working/glitched/non_working.


@IamSONIC

I retested all your shaders on Warp3DNova 1.82beta, and there is the result below.

For full images just click on thumbs. I didn't make images for every working shader, just choose a bunch of 25 random.


Working ones: they all work as before

Glitches ones: they all work now as expected and didn't glitch:

Colored snowflake: https://www.shadertoy.com/view/WsXBRl
Conic Sections: https://www.shadertoy.com/view/ttSGWh
Creation by Silexars: https://www.shadertoy.com/view/XsXXDn

Resized Image

mount mask: https://www.shadertoy.com/view/WdsfRf
Plasma cube: https://www.shadertoy.com/view/4d3SRN

Resized Image Resized Image

Shielding: https://www.shadertoy.com/view/XltGR2 (that one with texture "lichen.jpg" on Ichannel0)
The Pulse: https://www.shadertoy.com/view/lslSR7
v3 format: https://www.shadertoy.com/view/lsXcDN (that one with texture "stars.jpg" on Ichannel0).

Resized Image Resized Image


Now the big list of previously non-working ones, but working now:


Firstly the bad shaders which broken by design:

256b checkerboard zoom : https://www.shadertoy.com/view/MdXyR8 : works, but broken design of shader: have uninitialized variable inout "c" , so right when main{} starts add "c=vec4(0.0);" and it works (at least on Nova 1.82beta).
Amiga ball - globe 2 139 chars: https://www.shadertoy.com/view/XlfBW7: works, but also some hacky shader, also have some uninitialized variables. At least "O=vec4(0.0);" to make it works.
Amiga-Style Copper Bars: https://www.shadertoy.com/view/lldXRn : works, but bad code, have uninitialized variable "vec4 o", so initialize it to make it works : "vec4 o = vec4(0.0);"
inference jani: https://www.shadertoy.com/view/WlSGDh: works, but uninitialized variable again. Set at top of the mainImage fragColor=vec4(0.0); to make it works.
Plasma circles: https://www.shadertoy.com/view/XtXGW2: works, but uninitialized variable again. Set at top of the mainImage fragColor=vec4(0.0); to make it works.
Inside an Infinity Mirror: https://www.shadertoy.com/view/Wld3zM: broken shader, Division by zero bug: REPEAT.x component is 0 and passed to mod(). (c) Capehill



Now other working from before non-working shaders:

576 colors plasma: https://www.shadertoy.com/view/wl33Rj
Amiga Logo: https://www.shadertoy.com/view/lljyDz
AMIGA TWIST: https://www.shadertoy.com/view/MdBSWw
Amiga-style dots: https://www.shadertoy.com/view/4sKBWW
basic bitmap sinus scroll: https://www.shadertoy.com/view/XtyXzt : This one with Texture usage (font to Ichannel0)
Boing Ball by UnitZeroOne: https://www.shadertoy.com/view/4ssGWn
boney tunnel: https://www.shadertoy.com/view/3sGXzD

Resized Image Resized Image

circle inversion: https://www.shadertoy.com/view/tssfzB
coin coin: https://www.shadertoy.com/view/wdXBWj
Color variations: https://www.shadertoy.com/view/llXyWs

Resized Image Resized Image

distance meter: https://www.shadertoy.com/view/ldK3zD
Dolphin: https://www.shadertoy.com/view/4sS3zG : That one with lots of textures and have an uninitialized variable "ccd", so set it to 0.0.
Doodling with h0ffman: https://www.shadertoy.com/view/WdKSD1 : Multipass one.

Resized Image Resized Image

Enigma: https://www.shadertoy.com/view/4t2Bzh.
Friday Giro: https://www.shadertoy.com/view/wdXBzs That one have 2 uninitialized vars: g, gg. Same slow as on win10.

Resized Image Resized Image

GIT: https://www.shadertoy.com/view/Mdj3RV
Hello PsyGrid 1: can't find in ShaderToy database
Hexagonal Maze Flow: https://www.shadertoy.com/view/llSyDh
Journey to Another World v2: https://www.shadertoy.com/view/3dlfzj : That one have a lot of uninitialized vars which need to be set to make it works).
LSD 2D fx: https://www.shadertoy.com/view/ldBSRd : works

Resized Image Resized Image

LSD Triangle: https://www.shadertoy.com/view/4tdBRX
Mind Syrup: can't find in ShaderToy database, but it works
Neon Parallax: https://www.shadertoy.com/view/XssXz4
Non-Euclidean Geometry Test: https://www.shadertoy.com/view/4llSWf

Resized Image Resized Image

[NV15] Space Curvature: https://www.shadertoy.com/view/llj3Rz : That one use few textures 0: Stars, 1: Organic2
oily water plasma: https://www.shadertoy.com/view/lt3yRr
Outerspace 1: https://www.shadertoy.com/view/XlXcDl
Plasma 90x: https://www.shadertoy.com/view/4ssGR7
Psychodelic Pattern: https://www.shadertoy.com/view/XlcBzH
rainbow flow: https://www.shadertoy.com/view/ldcyR4
Rainbow Fractal Descent: https://www.shadertoy.com/view/4tGczc

Resized Image Resized Image

rainbow turbulence: https://www.shadertoy.com/view/3sSXRz
Random Isometric Blocks: https://www.shadertoy.com/view/ltSczW

Resized Image Resized Image

Ray Tracing sphere example: https://www.shadertoy.com/view/ldS3DW
Sine Puke II: https://www.shadertoy.com/view/4dXXzN

Resized Image Resized Image

skrolliparty 2019 invi amiga efx: https://www.shadertoy.com/view/WtSSR1
snow mountain: https://www.shadertoy.com/view/Xllyz4 : Even faster than on my PC/win10)
spinal cave: https://www.shadertoy.com/view/4s3yDM : This one with Texture usage (Organic1 to Ichannel0)

Resized Image Resized Image

spiral distance function: https://www.shadertoy.com/view/tdlyW4
star layers: https://www.shadertoy.com/view/MltXz7
tela da LSD: https://www.shadertoy.com/view/wtBXRd
Triangulated Heightfield Trick: https://www.shadertoy.com/view/XlcBRX : (same slow as on modern PC/win10 box).
trippy LSD psy colors: https://www.shadertoy.com/view/3djyDm

Resized Image Resized Image

tube_yurka: https://www.shadertoy.com/view/Wslfzl
Twisted Geometry: https://www.shadertoy.com/view/lt3XD8 : That one with Texture usage (MetalRust to Ichannel0)
VHS aesthetics: https://www.shadertoy.com/view/WdffW2 : That a MultiPass shader, start working normally since 1.15 version of ShaderJoy
viper mushroom: https://www.shadertoy.com/view/3dfBW8
winter_snow: https://www.shadertoy.com/view/Ml3SRs : (same slow as on modern PC/win10 box).
buoy: https://www.shadertoy.com/view/XdsGDB
Grid of Cylinders: https://www.shadertoy.com/view/4dSGW1
Oceanic: https://www.shadertoy.com/view/4sXGRM
star1: https://www.shadertoy.com/view/MlfSDS
Ray Marching Part 6: https://www.shadertoy.com/view/4tcGDr

Resized Image Resized Image



And now, those ones from non-working which still not works even on NOVA 1.82

All non-working shaders reported in respective bug reports, see below for more details:

Need more SGPRs. There was some heavy work done by Hans to reduce registers usage, but some still ask for more SGPRs. Just a few, and very hardcore ones, but still.
BZ: http://www.amiga.org/developer/bugreports/view.php?id=484

1. Abstract Terrain Objects: https://www.shadertoy.com/view/ttXGWH
2. AMIGAs 30th The Juggler: https://www.shadertoy.com/view/llXSWr
3. Black Rainbow Coconut: https://www.shadertoy.com/view/lt2SDD

100% CPU loading and busy loop forever. Those ones probably optimization issues.
BZ: http://www.amiga.org/developer/bugreports/view.php?id=689

1. An amiga intro: https://www.shadertoy.com/view/lty3zc
2. Amiga sinus scroll: https://www.shadertoy.com/view/4lVGzc: multipass one. BufferA is the one that causes 100% CPU loading.
3. Demoscene Museum: https://www.shadertoy.com/view/WsXBzS
4. Gate505: https://www.shadertoy.com/view/3dlBR2

OpImage/OpImageFetch not implemented
BZ: http://www.amiga.org/developer/bugreports/view.php?id=620

1. Rainbow Temple, Ungolfed: https://www.shadertoy.com/view/ts2yWV
2. trippy interactive spiral: https://www.shadertoy.com/view/4l3yD7

Unsupported/invalid composite constant type (OpTypeArray)
BZ 488: http://www.amiga.org/developer/bugreports/view.php?id=488

1. Business Card Raytracer: https://www.shadertoy.com/view/WtKXDw
2. wheelofconf: https://www.shadertoy.com/view/3dXfRH
3. Plasma Waves: https://www.shadertoy.com/view/ltXczj

Returning structs from functions aren't supported yet.
BZ 621: http://www.amiga.org/developer/bugreports/view.php?id=621

1. Boing ball by patu: https://www.shadertoy.com/view/MdcXR7
2. Cubic Dance: https://www.shadertoy.com/view/Wt2GRG
3. CGX orbit: https://www.shadertoy.com/view/4t2XzD
4. rm -f: https://www.shadertoy.com/view/MsVcRy
5. Ray tracing bounced spheres: https://www.shadertoy.com/view/3sfcRN


Unsupported/invalid composite constant type (OpTypeStruct).
BZ 573: http://www.amiga.org/developer/bugreports/view.php?id=573

1. Dispersion: https://www.shadertoy.com/view/XlscDH
2. GLSL smallpt: https://www.shadertoy.com/view/4sfGDB
3. Tunnel with lamps: https://www.shadertoy.com/view/MsVXzK
4. My improved Raytracer: https://www.shadertoy.com/view/Wd2yRV

And other bugs-errors:

1. Nouse - cis461: https://www.shadertoy.com/view/3dXBRr: Constructing struct XXX objects is not supported. BZ: http://www.amiga.org/developer/bugreports/view.php?id=622
2. fading triangles: https://www.shadertoy.com/view/wdsfRl: INTERNAL ERROR: SOP2 instruction can't have VGPRS source or destination registers. BZ: http://www.amiga.org/developer/bugreports/view.php?id=680
3. laser show: https://www.shadertoy.com/view/3dfBWj: Multipass. For BufferB have "Modulo for element type Int32 isn't implemented yet". BZ: http://www.amiga.org/developer/bugreports/view.php?id=623
4. Rainbow grid: https://www.shadertoy.com/view/wlSGDw: OpFWidth not implemented: http://www.amiga.org/developer/bugreports/view.php?id=491
5. Second Reality Plasma Cube: https://www.shadertoy.com/view/wdsBzS: heavy multipass shader. BufferD fail because MatrixInverse not implemented: http://www.amiga.org/developer/bugreports/view.php?id=619

6. Erikson's Wormhole: https://www.shadertoy.com/view/3djyRR: use for Ichannel2 some "volumes", not implemented in ShaderJoy.
7. Ray tracing polygons: can't find this one on ShaderToy base, but I see it use structs, so 99% will fail currently.


Final words:

@All
So on the whole, we can say as of the latest beta of Nova there were made some real kicking progress. Of course, some things are still not implemented (some instructions, better work with structures and arrays, some rendering bugs still here meaning there some flaws to find), but on whole it just day and light if we compare Nova 1.82 with 1.65 (or what public version now is). The amount and quality of the working shaders rise quite a lot. There is also a bunch of newly implemented instructions as well which should help AmiBoing guys and fresh GL4ES builds.

Thanks, Hans to spend time on improving it, Mattew who still pays for it, Capehill who still working on ShaderJoy, and Daniel for his work on ogles2 and very valuable to help with everything I ask him ever!


Edited by kas1e on 2020/12/14 20:40:09
Edited by kas1e on 2020/12/14 20:41:45
Edited by kas1e on 2020/12/14 20:57:27
Edited by kas1e on 2020/12/14 20:58:59
Edited by kas1e on 2020/12/14 21:16:07
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Shaderjoy 1.17
Just can't stay away
Just can't stay away


See User information
@kas1e

Thanks for the testing efforts! Some impressive shaders there.

Regarding 3D textures: W3DN Query test gives me "unsupported".

Go to top
Re: Shaderjoy 1.17
Home away from home
Home away from home


See User information
@Capehill
By 3D textures you mean those "Volumes" for ichannels like in that shader https://www.shadertoy.com/view/3djyRR in ichannel2?

If so we can probably make a feature request report, just to not forget about it.

Btw, related to ShaderJoy, is there something you works on for the moment ?:) What I really miss now (after checking a lot of shaders with textures and multipass ones) is some description file that ShaderJoy can handle, in which we can write all the paths and options for all ichannels and buffers.

Without that, it will be pretty hard to distribute textured/multipass shaders as they will not be "Dbl-click and it works". Some multipass ones have 6 shaders (main, common, 4 buffers) which have different settings for textures and buffers, and it sometimes quite hard to even run it one time :)

But will be nice to have something like :

01_multipass_shader.sjfrag (sj - shaderjoy, frag - fragment) together with 01_multipass_shader directory, in which put all the textures, main/common/buffers fragments, and describe it all in this sjfrag file.

Or something of that sort... Just so the final result will be that user see an icon, Dbl-click on it, and it just runs and works.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Shaderjoy 1.17
Just can't stay away
Just can't stay away


See User information
@kas1e

Yeah, if (2D) "textures" are X*Y, then "volumes" are X*Y*Z.

I have been slowly working on a project file system. Currently my plan is to do something like this:

Quote:

# Shaderjoy project file
Version=1.0

Image shader=shader.frag
Channel0 texture=texture.jpg filter=mipmap flip wrap=repeat
Channel1 buffer=a
Channel2
Channel3

BufferA shader=shader.frag
Channel0
Channel1
Channel2
Channel3

BufferB shader...


JSON would be probably better but I have tried to avoid extra dependencies and binary bloat (if statically linked). Maybe later.

Go to top
Re: Shaderjoy 1.17
Home away from home
Home away from home


See User information
@Capehill
Quote:

JSON would be probably better but I have tried to avoid extra dependencies and binary bloat (if statically linked). Maybe later.


Cool! Plain text format surely much better than any JSON or other formats. And all looks fine and clean in your example, just as expected :)

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Shaderjoy 1.17
Home away from home
Home away from home


See User information
@Capehill
After Hans implemented in 1.82 OpImageSampleExplicitLod/OpImageSampleProjExplicitLod and fixing some bugs, there is some really beautiful shaders work as well (click on tumbs for fullsize):

Alps: https://www.shadertoy.com/view/4ssXW2
Banished: https://www.shadertoy.com/view/XsX3DB

Resized Image Resized Image

Bridge: https://www.shadertoy.com/view/Mds3z2
Canyon: https://www.shadertoy.com/view/MdBGzG

Resized Image Resized Image

Cloud Ten: https://www.shadertoy.com/view/XtS3DD
Desert Canyon : https://www.shadertoy.com/view/Xs33Df

Resized Image Resized Image

Fish Swimming: https://www.shadertoy.com/view/ldj3Dm
Grid of Capsules: https://www.shadertoy.com/view/XdfXDB

Resized Image Resized Image

Neptune Racing: https://www.shadertoy.com/view/XtX3Rr
Unreal Intro : https://www.shadertoy.com/view/ls2SDD

Resized Image Resized Image

Venice: https://www.shadertoy.com/view/MdXGW2
Voronoi - rocks : https://www.shadertoy.com/view/MsXGzM

Resized Image Resized Image

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Shaderjoy 1.17
Home away from home
Home away from home


See User information
@kas1e

New food for the beast :)

https://www.shadertoy.com/view/lldGDr

If we can even run this one ..

Btw, great progress mate, kudos to all involved!

Go to top
Re: Shaderjoy 1.17
Home away from home
Home away from home


See User information
@Samo79
Nothing of that hardcore in that shader, just currently it didn't work because of:

unsupported opcodes OpImage/OpImageFetch: reported as BZ 620 : http://www.amiga.org/developer/bugreports/view.php?id=620

But some shaders which already works even harder/heavier than this one

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Shaderjoy 1.17
Just can't stay away
Just can't stay away


See User information
@kas1e

Quote:

https://www.shadertoy.com/view/XsG3z1

1). dbl-click on image.frag
2). RMB->Channels->BufferA->New
3). drop bufferA.frag to active bufferA tab.
4). RMB->Channels->Load Ichannel0 : set there BufferA
5). RMB->Channels->BufferA->Load Ichannel0: set there BufferA as well.

Now, the effect didn't show as expected. But, if I press "Compile", then it starts to works.


I think issue is specific to this shader and its way to initialize the buffer:

if(iFrame>9fragColor.xy clamp(vec2(newReactDiffavgReactDiff/.98), 0.1.);
    else 
fragColor vec4(noise1.);


So, it applies noise only in the very beginning. As one has to setup everything manually in Shaderjoy 1.17, changes are that frame counter is 10 or higher by the time everything has been configured. Shaderjoy initializes frame counter when Image shader is loaded. I think project file helps with this.

However, frame counter in Shaderjoy (or toy) doesn't seem to reset when toggling between window/fullscreen so it's possible to see this shader break also in Shadertoy. It breaks differently on Shaderjoy, I think the reason is that FBO is not copied to a new one when toggling happens.

Need to recheck this one when Shaderjoy 1.18 is done.

Go to top
Re: Shaderjoy 1.17
Home away from home
Home away from home


See User information
@Capehill
Quote:

Need to recheck this one when Shaderjoy 1.18 is done.


Yes, if we will have project files, then everything will be loaded at once right at the init stage => can fix it indeed.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Shaderjoy 1.17
Not too shy to talk
Not too shy to talk


See User information
@Capehill
Quote:
JSON would be probably better but I have tried to avoid extra dependencies and binary bloat (if statically linked). Maybe later.

ShaderToy uses JSON for its projects, I'd again recommend to clone and eventually expand its specs. Also, the footprint of a simple JSON parser is neglectable (maybe tiny-json is appropriate / good enough for your purpose).

@kas1e
Quote:
Plain text format surely much better than any JSON

Certainly not, especially in this case when ShaderToy already uses JSON for that very same task.

Go to top
Re: Shaderjoy 1.17
Just can't stay away
Just can't stay away


See User information
@Daytona675x

Do you have their schema? I tried to check their iOS app a couple of times but it didn't seem that obvious to me.

Go to top
Re: Shaderjoy 1.17
Home away from home
Home away from home


See User information
@Daniel
All the time i look at json config files, it looks like html mess. Lots of tags, tabs and crap. While the pure text file configs like Capehill do always clean, small, slick and just looks feels and understands very good.

Basically cloning the way how shadertoy handle multpass and texture shaders is of no big way, anyway it not straigh copy, and need manual work. So why use that json stuff, if all can be plain, slick , small and clean as we all love ?:)

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Shaderjoy 1.17
Not too shy to talk
Not too shy to talk


See User information
@Capehill
I didn't find a concrete documentation but I find the format rather self-explaining.
If you have an account at ShaderToy you can easily download the JSON for a specific shader that way:

- login
- go to your apps, create one if you didnt yet and then grab the App Key
- browse to a nice simple shader for a start, e.g. this one
- in the URL you'll find the shader's ID, in this case Xt2XzW
- use that ID and your key to fill out this URL:
https://www.shadertoy.com/api/v1/shaders/ID?key=KEY

There you go:
{
    
"Shader": {
        
"ver""0.1",
        
"info": {
            
"id""Xt2XzW",
            
"date""1442017330",
            
"viewed"5769,
            
"name""Beenox goes BlackOps 3",
            
"username""fungos",
            
"description""my first shader toying, had nothing to do and wanted to try distance fields. still need improve this a lot, mostly  reflection and bo3 logo material (maybe some fire), suggestions? :)\n\nSome machines can't compile the shader, help someone?",
            
"likes"15,
            
"published"3,
            
"flags"0,
            
"usePreview"0,
            
"tags": [
                
"logo",
                
"distance",
                
"geometry",
                
"beenox",
                
"blackops3",
                
"cod"
            
],
            
"hasliked"0
        
},
        
"renderpass": [
            {
                
"inputs": [
                ],
                
"outputs": [
                ],
                
"code""#define A 3.545\n#define B 1.15\n#define M smoothstep\n\n\/\/ rotate on axis Z\nvec3 Z(vec3 v, float a)\n{\n    vec3 vo = v; float c = cos(a); float s = sin(a);\n    v.x = c * vo.x - s * vo.y;\n    v.y = s * vo.x + c * vo.y;\n    return v;\n}\n\n\/\/ Rotate on axis Y\nvec3 Y(vec3 v, float a)\n{\n    vec3 vo = v; float c = cos(a); float s = sin(a);\n    v.x = c * vo.x - s * vo.z;\n    v.z = s * vo.x + c * vo.z;\n    return v;\n}\n\n\/\/ Torus82\nfloat T(vec3 p, vec2 t)\n{\n    vec2 q = vec2(sqrt(p.x * p.x + p.y * p.y) - t.x, p.z);\n    q = q*q; q = q*q; q = q*q;\n    return pow(q.x + q.y, 1. \/ 8.) - t.y;\n}\n\n\/\/ Gear\nfloat G(vec3 p, float a, float r)\n{\n    float d = 1.;\n    for (int i = 0; i < 6; i++)\n    {\n        vec3 q = abs(Z(p, a) - vec3(.0, r + .25, .0));\n        d = min(d, max(q.z - .3, max((q.x * .6 + q.y * .7), q.y) - .25));\n        a += 1.03;\n    }\n    \n    return max(-d, T(p, vec2(r, .1)));\n}\n\n\/\/ sdBox\nfloat X(vec3 p, vec3 b)\n{\n    vec3 d = abs(p) - b;\n    return min(max(d.x, max(d.y, d.z)), .0) + length(max(d, .0));\n}\n\n\/\/ sdHexPrism\nfloat H(vec3 p, vec2 h)\n{\n    vec3 q = abs(p);\n    return max(q.z - h.y, max((q.x + q.y * .3), q.y) - h.x);\n}\n\n\/\/ smin\nfloat S(float a, float b, float k)\n{\n    float h = clamp(.5 + .5 * (b - a) \/ k, 0., 1.);\n    return mix(b, a, h) - k * h * (1. - h);\n}\n\n\/\/ Beenox\nfloat BX(float t, vec3 p, float f)\n{\n    float s = t*t;\n    if (t > A) s \/= 2.;\n    p = Y(p, s);\n    \n    float a = G(p, .6, f * .5);\n    float b = length(p) - f * .33;\n    return min(b, a);\n}\n\n\/\/ Black Ops 3\nfloat BO(vec3 p, float x, float t)\n{\n    vec2 z = vec2(.12, .15);\n    vec3 w = vec3(.12, z);\n    \n    \/\/ 1\n    float a = X(p - vec3(x, .0, .0), vec3(.14, .6, .15));\n    float b = X(p - vec3(x + .1, .48, .0), w);\n    float c = H(Z(p - vec3(x + .065, .32,  .0), .8), z);\n    float d = X(p - vec3(x + .1, -.49, .0), vec3(.12, .11, .15));\n    float e = H(Z(p - vec3(x + .065, -.335, .0), -.75), z);\n    a = min(a, min(e, min(d, min(c, b))));\n\n    \/\/ 2\n    c = mix(.0, .15, M(0., 4.5, t));\n    d = mix(.0, .2, M(.7, .8, t));\n    b = X(p - vec3(.0, .0, .0), vec3(d, .6, c));\n\n    \/\/ 3\n    c = X(p - vec3(-x, .0, .0), vec3(.13, .6, .15));\n    d = X(p - vec3(-x - .1, .48, .0), w);\n    e = H(Z(p - vec3(-x - .065, .32, .0), -.8), z);\n    float f = X(p - vec3(-x - .1,-.48, .0), vec3(.12, .12, .15));\n    float g = H(Z(p - vec3(-x - .065, -.335, .0), .75), z);\n    c = min(c, min(g, min(f, min(e, d))));\n    \n    return min(c, min(b, a));\n}\n\nfloat map(float t, vec3 p)\n{\n    float x = 0.;\n    float y = 0.;\n\tfloat d = 0.;\n    if (t < A + B)\n\t{\n        d = BX(t, p, 1.);\n\t}\n    else if (t < 5.)\n\t{\n        d = BX(A + B, p, 1.);\n\t}\n    else if (t < 7.)\n    {\n        x = BX(A + B, p, M(1.1, 0., t - 5.));\n        y = X(p, vec3(.15, .6 * M(0., 1., t - 5. + .4), .15));\n        d = S(y, x, .1);\n    }\n    else\n    {\n        t -= 7.;\n        x = .2 * pow(M(.0, 1., t), .5);\n        y = .25 * pow(M(1.2, 3., t), .5);\n        d = BO(p, x + y, t);\n    }\n\treturn d;\n}\n\n\/\/ plane - intersection with a predefined plane\nvec3 P(vec3 p, vec3 d) \n{\n    vec3 n = vec3(0., 1., 0.);\n    float f = dot(-n * .8 - p, n) \/ dot(n, d);\n    return p + d * f;\n}\n\n\/\/ Material used for the infinite plane\nvec2 MAT(vec2 uv)\n{\n    vec2 uv2 = mod(uv, vec2(2.)) - mod(uv, vec2(1.));\n    float d = uv2.x + uv2.y; \n    d = pow(d - 1., 2.) * .4;\n    \n    float s = d;\n    d += s * .2;\n\n    \/\/d - diffuse, s - specular\n    return vec2(d, s * s * .5 + .1);\n}\n\n\/\/ render background layer used for reflection\nvec3 BG(vec3 p, vec3 d, vec3 l)\n{\n    \/\/ plane normal\n    vec3 n = vec3(0., 1., 0.);\n    \n    \/\/ diffuse lighting for the plane\n    float df = dot(n, l) * .5 + .5; \n    \n    \/\/ to blend the plane with the sky\n    float a = max(0., dot(d, -n)); \/\/ alpha - this coefficient is used\n    \n    \/\/ get the floor material\n    vec2 m = MAT(P(p, d).xz); \/\/ x = diffuse coefficient, y = specular coefficient\n    \n    \/\/ atmosphere\n    vec3 at = vec3(.3, .4, .7) * (1. - abs(d.y)) * 1.5;\n\n    \/\/ calculate the planes color\n    vec3 c = m.x * vec3(.4) * df + (m.y * .7) * (at * .2);\n    \n    \/\/ reduce fog\n    a = pow(a, .4);\n    \n    \/\/ mix the plane with the sky\n    return mix(at, c, a);\n}\n\n\/\/ Normal\nvec3 N(float t, vec3 p, float e)\n{\n\tfloat d = map(t, p);\n\treturn normalize(\n        vec3(\n            map(t, p + vec3(e, 0, 0)) - d,\n            map(t, p + vec3(0, e, 0)) - d,\n            map(t, p + vec3(0, 0, e)) - d\n        )\n    );\n}\n\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord )\n{\n    float t = 0.;\n    if (iResolution.x <= 400.0) t = mod(iTime - 6.455, 15.);\n    else t = mod(iTime, 15.);\n    vec2 uv = fragCoord.xy \/ iResolution.xy - .5;\n    uv.x *= iResolution.x \/ iResolution.y; \/\/fix aspect ratio\n    if (iResolution.y < 200.0) t = A;\n    \n    \/\/ ray position\n    vec3 p = vec3(0., 0., 2.1); \n    \n    \/\/ ray direction\n    vec3 d = normalize(Y(vec3(uv, 1.), 3.14159));\n    \n    \/\/ light\n    vec3 l = vec3(-.5, 1.2, .5);\n    \n    \/\/ background\n    \/\/vec3 c = vec3(0.);\n    vec3 c = BG(p, d, l);\n\n    \/\/ raymarching\n    float di = 0.;\n    for (int i = 0; i < 75; i++)\n    {\n        \/\/ scene\n        di = map(t, p);\n        p += d * di * .4;\n\n        \/\/ too far away from the object or close enough, stop\n        if (di > 5. || di < .03) \n            break;\n    }\n\n    if (di < .03)\n    {\n        vec3 n = N(t, p, .002);\n\n        \/\/ a bit more wierd diffuse lighting, but looks great\n        float diffuse = dot(l, n) * .1 + .5;\n        diffuse = pow(diffuse, 1.5);\n\n        \/\/ object color\n        c = mix(vec3(.4, .4, 1.4), vec3(.1), M(B, 7., t));\n\n        \/\/ reflection\n        c = mix(c * diffuse, BG(p, reflect(d, n), l), (1.0 + dot(d, n)) * .6 + .2);\n\n        \/\/ self occlusion\n        c *= map(t, p + n) * .5 + .5;\n    }    \n    \n    \/\/ fade in\n    c = mix(c, vec3(0.), M(3., 0., t));\n\n    \/\/ fade out\n    c = mix(c, vec3(0.), M(14., 15., t)); \n    \n    fragColor = vec4(c, 1.);\n}",
                
"name""Image",
                
"description""",
                
"type""image"
            
}
        ]
    }
}


This should give you a good idea on the most important format details already. From there either take a look at shaders with more inputs etc. or play around with your own shader project.

@kas1e
Quote:
All the time i look at json config files, it looks like html mess. Lots of tags, tabs and crap.

That sounds as if you were looking at xml and not json.
json can be almost as compact as an ini txt file, in fact, if you want, you can easily mimic that like
{
    
"ini-field1""bla",
    
"ini-field2""blurp",
    
"ini-field3""blorp"
}

Apart from the " I see no bloat or less readability compared to an ini file equivalent. Tabs and stuff are purely optional, of course.
But if you want you get objects, arrays, some standard types, etc. in a compact, easy to read and most of all standardized way.

I use JSON for some years now for almost all my "I need some data / config / whatever" files. And I never looked back.

Go to top
Re: Shaderjoy 1.17
Home away from home
Home away from home


See User information
@Daniel
Quote:

That sounds as if you were looking at xml and not json.


Indeed :)

Quote:

json can be almost as compact as an ini txt file, in fact, if you want, you can easily mimic that like


If it can be _that_ clean, then yeah, looks good.

@Capehill
I use it for some ports before tiny-json at which Daniel point out, it straight compiles without needs to touch anything and can be inbuild directly to the binary in a static form with no probs.

That if you of course want to follow JSON way.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top

  Register To Post
« 1 ... 15 16 17 (18) 19 20 21 ... 24 »

 




Currently Active Users Viewing This Thread: 2 ( 0 members and 2 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project