Author Topic: Fun with Pixel Shaders and maths  (Read 9475 times)

felipe

  • Member
  • *****
  • Posts: 1328
  • Eagles are just great!
Re: Fun with Pixel Shaders and maths
« Reply #30 on: April 08, 2018, 10:14:54 AM »
Siekmanski from the example d3d9_alpha.asm i get this error:

Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

 Assembling: ...\d3dx9_asm\sources\d3d9xAlpha\d3d9_al
pha.asm

***********
ASCII build
***********

\masm32\d3dx9includes\limits.inc(33) : error A2005: symbol redefinition : MB_LEN
_MAX
_
Assembly Error
...

I have added the folders of the includes and libs in the masm32 folder (d3dx9includes and d3dx9libs). Thanks for any help, it will be great to use the includes for directx9.
Felipe.

felipe

  • Member
  • *****
  • Posts: 1328
  • Eagles are just great!
Re: Fun with Pixel Shaders and maths
« Reply #31 on: April 08, 2018, 10:22:36 AM »
I don't use the DirectX9 wrapper lib anymore and wrote my own libs to keep the executables very small.

Can you explain this a little bit please? If you want to do it here or in the game development forum is ok too.  :idea:
Felipe.

Siekmanski

  • Member
  • *****
  • Posts: 2326
Re: Fun with Pixel Shaders and maths
« Reply #32 on: April 08, 2018, 02:30:39 PM »
Quote
I have added the folders of the includes and libs in the masm32 folder (d3dx9includes and d3dx9libs). Thanks for any help, it will be great to use the includes for directx9.
The reason I included all includes and libs is because they are not exactly the same as in the Masm32 SDK from 2004.
So, it's better to keep them apart from the original ones from the Masm32 SDK.
The sources are 14 years old and based on the DirectX 9 SDK from late 2003.

You can download the latest DirectX9 End-User Runtimes,
DirectX End-User Runtimes (June 2010)
https://www.microsoft.com/en-us/download/details.aspx?id=8109

I don't use the DirectX9 wrapper lib anymore and wrote my own libs to keep the executables very small.

Can you explain this a little bit please? If you want to do it here or in the game development forum is ok too.  :idea:

Because I was fed up with the fact that the user needed the exact same DirectX 9 wrapper-lib version (d3dx9.lib, more than 20 different libs......) installed to run.
To prefent this I wrote my own math lib and picture/texture loader lib for Direct3D9.
My latest sources only need d3d9.lib (d3d9.dll) to work.
Those libs use SIMD instructions so, you might want to update your Masm Assembler to a more resent one.

Creative coders use backward thinking techniques as a strategy.

felipe

  • Member
  • *****
  • Posts: 1328
  • Eagles are just great!
Re: Fun with Pixel Shaders and maths
« Reply #33 on: April 08, 2018, 02:48:12 PM »
Siekmanski: first point: ok thanks one last question: any tips to create include files for libraries like those of the directx9 sdk? What was your main procedure to do such thing that time? To the second point: amazing!  :icon14:
Thanks a lot one more time.  :icon14:
Felipe.

Siekmanski

  • Member
  • *****
  • Posts: 2326
Re: Fun with Pixel Shaders and maths
« Reply #34 on: April 08, 2018, 03:03:11 PM »
I translated it line by line myself, took a really long time.  :biggrin:
Creative coders use backward thinking techniques as a strategy.

felipe

  • Member
  • *****
  • Posts: 1328
  • Eagles are just great!
Re: Fun with Pixel Shaders and maths
« Reply #35 on: April 08, 2018, 03:27:50 PM »
Code: [Select]
/*==========================================================================;
 *
 *  Copyright (C) Microsoft Corporation.  All Rights Reserved.
 *
 *  File:   d3d9.h
 *  Content:    Direct3D include file
 *
 ****************************************************************************/

#ifndef _D3D9_H_
#define _D3D9_H_

#ifndef DIRECT3D_VERSION
#define DIRECT3D_VERSION         0x0900
#endif  //DIRECT3D_VERSION

// include this file content only if compiling for DX9 interfaces
#if(DIRECT3D_VERSION >= 0x0900)


/* This identifier is passed to Direct3DCreate9 in order to ensure that an
 * application was built against the correct header files. This number is
 * incremented whenever a header (or other) change would require applications
 * to be rebuilt. If the version doesn't match, Direct3DCreate9 will fail.
 * (The number itself has no meaning.)*/

#ifdef D3D_DEBUG_INFO
#define D3D_SDK_VERSION   (32 | 0x80000000)
#define D3D9b_SDK_VERSION (31 | 0x80000000)

#else
#define D3D_SDK_VERSION   32
#define D3D9b_SDK_VERSION 31
#endif


#include <stdlib.h>

#define COM_NO_WINDOWS_H
#include <objbase.h>

#include <windows.h>

I see. I'm willing to do that, the problem is than i don't know how. Above is a little bit of the .h file of the d3d9. From the directx 9 sdk (which i believe is now freeware or something). I guess i will look to every include file in the masm package and compare with this .h files to undestand the syntax (actually i have never write a macro, maybe 1 very simple like an exercise or study and for 16 bits). Finally, if i really can't do this i guess i will give up with directx. I have searched in the fasm include from the main page and are very small and incompletes comparing with the ones of the masm package. So i really don't think there are other assemblers with includes for directx. Would be a good idea (just to do directx programming) to work with c to have this headers files working but using inline assembly all the time? Really don't want that, but can't think on more options by now. Ok good night and thanks again.  :icon14:
Felipe.

caballero

  • Member
  • *****
  • Posts: 1468
  • Matrix - Noah
    • abre ojos ensamblador
Re: Fun with Pixel Shaders and maths
« Reply #36 on: April 10, 2018, 04:38:13 AM »
Why don't move this topic to the games thread that maybe should be named "graphics" and "games"? :t
The logic of the error is hidden among the most unexpected lines of the program

LiaoMi

  • Member
  • ****
  • Posts: 698
Re: Fun with Pixel Shaders and maths
« Reply #37 on: February 05, 2020, 01:17:04 AM »
New DirectX Shader Compiler based on Clang/LLVM now available as Open Source - https://devblogs.microsoft.com/directx/new-directx-shader-compiler-based-on-clangllvm-now-available-as-open-source/
DX Compiler - https://github.com/microsoft/DirectXShaderCompiler
DX Compiler release for July 2019 - https://github.com/microsoft/DirectXShaderCompiler/releases

The DirectX Shader Compiler project includes a compiler and related tools used to compile High-Level Shader Language (HLSL) programs into DirectX Intermediate Language (DXIL) representation. Applications that make use of DirectX for graphics, games, and computation can use it to generate shader programs.

Features and Goals
The starting point of the project is a fork of the LLVM and Clang projects, modified to accept HLSL and emit a validated container that can be consumed by GPU drivers. At the moment, the DirectX HLSL Compiler provides the following components: dxc.exe, a command-line tool that can compile HLSL programs for shader model 6.0 or higher dxcompiler.dll, a DLL providing a componentized compiler, assembler, disassembler, and validator various other tools based on the above components

The Microsoft Windows SDK releases include a supported version of the compiler and validator.

The goal of the project is to allow the broader community of shader developers to contribute to the language and representation of shader programs, maintaining the principles of compatibility and supportability for the platform. It's currently in active development across two axes: language evolution (with no impact to DXIL representation), and surfacing hardware capabilities (with impact to DXIL, and thus requiring coordination with GPU implementations).
 

ShaderFlex™ is a powerful stand-alone GPU shader authoring environment for DirectX 11 similar to legacy tools like NVidia FX Composer and AMD RenderMonkey.
Whether you're a beginner looking to learn about shaders, a graphics hobbyist wanting to sandbox and share your latest creations or a seasoned graphics engineer prototyping some killer special effects for an upcoming AAA game, ShaderFlex is the tool for you.
Scroll down for an overview of ShaderFlex or check out the Features page for more in-depth information.

NOTE: ShaderFlex is still in development and a beta program is planned for later this year.

Above is an image of ShaderFlex rendering over 500,000 dynamic blades of grass, with depth of field and HDR blooming

Main Features
DirectX 11 support ( extensive control of the API through ShaderFlex's material definitions )
Shader models ( 4_0_level_0_1, 4_0_level_0_3, 4_0, 4_1 and 5_0 )
Shader types ( compute, vertex, geometry, hull, domain, pixel )
Complex non-linear multi-pass support ( for rendering effects like smooth particle hydrodynamics or fluid simulations which require many scattered passes )
Uses proprietary 100% GPU accelerated user interface ( runs smooth on 4K+ displays, dockable, supports HiDPI scaling, abstracted from Windows )
NodeFlex support ( use NodeFlex and our customizable DX11 graph system to auto-generate your shaders and create your own reusable code generating logic )
Oculus Rift DK1 and DK2 support ( using Direct HMD Access and latest SDK )
3DConnexion SpaceMouse support ( and related products )
Debugging capabilities ( live preview, resources, ASM, timing, passes, shader feedback )
Scene scripting ( setup render targets, feed values to shaders, animated objects, and control the scene and rendering per frame )
Material definitions ( easy to use C++ style material definition for setting up resources, views, shaders, states, passes, etc. )
RenderFlex ( export your scenes in binary format to share with other using RenderFlex )
Simulation and Animation ( ability to run simulation passes at different frequencies than other rendering or compute passes )
Texture support ( .jpg, .png, .dds, .tga, .ppm, .bmp.dib, .pfm, .hdr, .tif, .gif )
ShaderFlex Material API ( lightweight API to access all data from a material )
ShaderFlex Rendering API ( integration API to load and render ShaderFlex materials in your rendering pipeline )
AutoDesk FBX support ( .fbx, .obj, .3ds, animation and CPU skinning )
Stream-output support ( render geometry to buffers for later use )
indirect draw/compute ( keep the GPU from stalling by initiating draw/dispatch calls using values from a DX Buffer )
Data Caching ( generate data from a compute shader in an INIT pass and save the data to file for future quick loading )
Pass iterations ( simply tell a pass how many times it should execute and access the iteration count and iteration index from your shaders )
Compute generated vertex and index buffers ( generate and render geometry entirely on the GPU )
Access mesh data from compute shaders ( get the position, normal and other data for processing in a compute shader, for example generating static ambient occlusion )
Flexible viewport ( go full screen, full window, choose from a selection of standard resolutions or choose your own )
Full access to mouse/touch input data from shaders
Auto-draw ( tell a rendering pass how many fake vertices to render, and use the SV_VertexID to dynamically generate geometry like grass blades for example )
Geometry instancing
Tweaks and presets ( shader variable overrides and per-material presets )
Supports WARP software rendering
Code Editing ( Intellisense style code editing, auto-completion tips and other helpers, code preview )
Multiple projects ( open multiple projects at the same time )
Scene editor ( build hierarchical scenes using frame/camera/light/mesh entities and post fx filters, each entity can have unlimited materials attached )
Auto generate mip map levels on the GPU
Volume Texture Targets ( render into volume slices or use a compute shader to do the same )
Cube Texture Targets ( render into cube faces or use a compute shader to do the same )
2D/3D/Volume texture arrays ( use them as shader resources, unordered access buffers or render targets )
Resource Views ( over 31 different types of shader resource, unordered access and render target views )

USING UNITY AS AN FX COMPOSER REPLACEMENT FOR SHADER PROTOTYPING - https://interplayoflight.wordpress.com/2013/02/04/unity-as-an-fx-composer-replacement-for-shader-prototyping/
ShaderMan ShaderToy to ShaderLab Converter - https://github.com/smkplus/ShaderMan

If you’ve tried dabbling with shaders at all, you’ve probably come across ShaderToy – an online shader showcase with some pretty amazing examples of what’s possible in a few lines of shader code, inspired greatly by classic demoscene coding. Here’s just two examples: https://www.shadertoy.com/view/4dl3zn

It’s an amazing resource, not only for inspiration but for learning how to create shaders, since every example comes with full source code which you can edit and immediately test online in your browser, alter parameters, supply different inputs etc.

The shaders exhibited on ShaderToy are exclusively written in GLSL, and run in your browser using WebGL.I write an automatic conversion tool to turn a GLSL shader into an HLSL shader that help you fast convert ShaderToy to ShaderLab unity.

GLSL-to-HLSL reference - https://docs.microsoft.com/en-us/previous-versions/windows/apps/dn166865(v=win.10)

Open-sourcing the Microsoft Edge WebGL GLSL transpiler - https://blogs.windows.com/msedgedev/2016/06/09/open-sourcing-the-microsoft-edge-webgl-glsl-transpiler/
Microsoft Edge WebGL Implementation - https://github.com/MicrosoftEdge/WebGL
What is a GLSL::HLSL transpiler?
WebGL web pages run ‘programs’ (shaders) on your GPU to render 3D content; these programs are written in the GLSL shading language. Microsoft Edge uses the DirectX subsystem in Windows (and HLSL, a different Windows-specific shading language) to render content.

Microsoft Edge converts WebGL content to DirectX equivalents to display it; the WebGL renderer converts WebGL calls into DirectX equivalents, and the transpiler converts GLSL shaders to HLSL shaders.

The ANGLE project - https://github.com/google/angle – as used in Chrome and Firefox – has similar functionality.

As an example of this conversion, here’s a super-simple program that paints a red pixel:

Code: [Select]
GLSL:
void main()

{

    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); // r g b a

}
HLSL:
float4 main() : SV_Target

{

    return float4(1.0f, 0.0f, 0.0f, 1); // r g b a

}
The transpiler (like any compiler) parses the GLSL program, checks for correctness and security constraints, and applies a conversion process to produce HLSL output.


LiaoMi

  • Member
  • ****
  • Posts: 698
Re: Fun with Pixel Shaders and maths
« Reply #38 on: February 05, 2020, 02:04:19 AM »
CrossShader - A tool (Web-Tool) for cross compiling shaders. Convert between GLSL, HLSL, Metal Shader Language, or older versions of GLSL - https://alain.xyz/libraries/crossshader
A cross compiler for shader languages. Convert between SPIR-V, GLSL / GLSL ES, HLSL, Metal Shader Language, or older versions of a given language.

Programming guide for HLSL https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx9-graphics-reference-asm-ps-3-0
PDF - https://docs.microsoft.com/en-us/windows/win32/opbuildpdf/direct3dhlsl/toc.pdf?branch=live

Effect-Compiler Tool - FXC (fxc.exe) is an offline tool for compiling HLSL shaders for all versions of Direct3D. The tool is located at: C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64
Offline Compiling - https://docs.microsoft.com/en-us/windows/win32/direct3dtools/dx-graphics-tools-fxc-using

daydreamer

  • Member
  • *****
  • Posts: 1353
  • building nextdoor
Re: Fun with Pixel Shaders and maths
« Reply #39 on: February 05, 2020, 02:17:07 AM »
many cool tools LiaoMi :thumbsup:
Quote from Flashdance
Nick  :  When you give up your dream, you die
*wears a flameproof asbestos suit*
Gone serverside programming p:  :D
I love assembly,because its legal to write
princess:lea eax,luke
:)

Siekmanski

  • Member
  • *****
  • Posts: 2326
Re: Fun with Pixel Shaders and maths
« Reply #40 on: February 05, 2020, 03:04:59 AM »
Great research!  :cool:
The GLSL-HLSL transpiler is very interesting stuff.  :thumbsup:
Creative coders use backward thinking techniques as a strategy.

LiaoMi

  • Member
  • ****
  • Posts: 698
Re: Fun with Pixel Shaders and maths
« Reply #41 on: February 05, 2020, 03:25:14 AM »
 :biggrin: Thanks!
I was looking for debugging capability and a converter that could translate shaders into each other. The web version(CrossShader) is the most convenient for conversion, unity engine as a tool for graphical presentation  :rolleyes:

WebGL - https://www.shadertoy.com/view/Xsc3RH
Code: [Select]
#version 330
uniform vec3      iResolution;           // viewport resolution (in pixels)
uniform float     iTime;                 // shader playback time (in seconds)
uniform float     iTimeDelta;            // render time (in seconds)
uniform int       iFrame;                // shader playback frame
uniform float     iChannelTime[4];       // channel playback time (in seconds)
uniform vec3      iChannelResolution[4]; // channel resolution (in pixels)
uniform vec4      iMouse;                // mouse pixel coords. xy: current (if MLB down), zw: click

uniform sampler2D iChannel0;             // NOTE: this can vary depending on the shadertoy!
uniform sampler2D iChannel1;     
uniform sampler2D iChannel3;
uniform sampler2D iChannel4;

uniform vec4      iDate;                 // (year, month, day, time in seconds)
uniform float     iSampleRate;           // sound sample rate (i.e., 44100)

const float pi = 3.1415927;

float sdSphere( vec3 p, float s )
{
  return length(p)-s;
}

float sdTorus( vec3 p, vec2 t )
{
  vec2 q = vec2(length(p.xz)-t.x,p.y);
  return length(q)-t.y;
}

float sdCappedCylinder( vec3 p, vec2 h )
{
  vec2 d = abs(vec2(length(p.xz),p.y)) - h;
  return min(max(d.x,d.y),0.0) + length(max(d,0.0));
}

// 👉 Insert your shadertoy here:
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 pp = fragCoord.xy/iResolution.xy ;
pp = -1.0 + 2.0*pp;
pp.x *= iResolution.x/iResolution.y;

vec3 lookAt = vec3(0.0, 0.0, 0.0);
   
    float eyer = 2.0;
    float eyea = (iMouse.x / iResolution.x) * pi * 2.0;
    float eyea2 = ((iMouse.y / iResolution.y)-0.24) * pi * 2.0;
   
vec3 ro = vec3(
        eyer * cos(eyea) * sin(eyea2),
       eyer * cos(eyea2),
        eyer * sin(eyea) * sin(eyea2)); //camera position
   
   
vec3 front = normalize(lookAt - ro);
vec3 left = normalize(cross(normalize(vec3(0.0,1,0)), front));
vec3 up = normalize(cross(front, left));
vec3 rd = normalize(front + left*pp.x + up*pp.y); // rect vector
   
   
    vec3 bh = vec3(0.0,0.0,0.0);
    float bhr = 0.2;
    float bhmass = 20.0;
    bhmass *= 0.001; // premul G
   
    vec3 p = ro;
    vec3 pv = rd;
    float dt = 0.02;
   
    vec3 col = vec3(0.0);
   
    float noncaptured = 1.0;
     
    vec3 c1 = vec3(0.9,0.35,0.1);
    vec3 c2 = vec3(1.0,0.8,0.6);
   
   
    for(float t=0.0;t<1.0;t+=0.005)
    {
        p += pv * dt * noncaptured;
       
        // gravity
        vec3 bhv = bh - p;
        float r = dot(bhv,bhv);
        pv += normalize(bhv) * ((bhmass) / r);
       
        noncaptured = smoothstep(0.0, 0.1, sdSphere(p-bh,bhr));
       
        // Texture for the accretion disc
        float dr = length(bhv.xz);
        float da = atan(bhv.x,bhv.z);
        vec2 ra = vec2(dr,da * (0.01 + (dr - bhr)*0.002) + 2.0 * pi + iTime*0.002 );
        ra *= vec2(10.0,20.0);
       
        vec3 dcol = mix(c2,c1,pow(length(bhv)-bhr,0.5)) * max(0.0,texture(iChannel1,ra*vec2(0.1,0.5)).r+0.05) * (4.0 / ((0.001+(length(bhv) - bhr)*50.0) ));
       
        col += max(vec3(0.0),dcol * smoothstep(0.0, 1.0, -sdTorus( (p * vec3(1.0,25.0,1.0)) - bh, vec2(0.4,0.99))) * noncaptured);
       
     //   col += dcol * (1.0/dr) * noncaptured * 0.005;
       
        // Glow
        col += vec3(1.0,0.9,0.85) * (1.0/vec3(dot(bhv,bhv))) * 0.0033 * noncaptured;
       
    }
   
    // BG
 //   col += pow(texture(iChannel0,pv.xy).rgb,vec3(5.0)) * 0.25;
   
    // FInal color
    fragColor = vec4(col,1.0);
}

void main()
{
    vec4 outColor = vec4(0.0, 0.0, 0.0, 0.0);
    mainImage(outColor, vec2(0.0, 0.0));
    gl_FragColor = outColor;
}

HLSL
Code: [Select]
uniform float3 iResolution;
uniform float4 iMouse;
uniform float iTime;
uniform sampler2D iChannel1;
uniform float iTimeDelta;
uniform int iFrame;
uniform float iChannelTime[4];
uniform float3 iChannelResolution[4];
uniform sampler2D iChannel0;
uniform sampler2D iChannel3;
uniform sampler2D iChannel4;
uniform float4 iDate;
uniform float iSampleRate;

static float4 _gl_FragColor;

struct SPIRV_Cross_Output
{
    float4 _gl_FragColor : COLOR0;
};

float sdSphere(float3 p, float s)
{
    return length(p) - s;
}

float sdTorus(float3 p, float2 t)
{
    float2 q = float2(length(p.xz) - t.x, p.y);
    return length(q) - t.y;
}

void mainImage(inout float4 fragColor, float2 fragCoord)
{
    float2 pp = fragCoord / iResolution.xy;
    pp = (-1.0f).xx + (pp * 2.0f);
    pp.x *= (iResolution.x / iResolution.y);
    float3 lookAt = 0.0f.xxx;
    float eyer = 2.0f;
    float eyea = ((iMouse.x / iResolution.x) * 3.1415927410125732421875f) * 2.0f;
    float eyea2 = (((iMouse.y / iResolution.y) - 0.23999999463558197021484375f) * 3.1415927410125732421875f) * 2.0f;
    float3 ro = float3((eyer * cos(eyea)) * sin(eyea2), eyer * cos(eyea2), (eyer * sin(eyea)) * sin(eyea2));
    float3 front = normalize(lookAt - ro);
    float3 left = normalize(cross(float3(0.0f, 1.0f, 0.0f), front));
    float3 up = normalize(cross(front, left));
    float3 rd = normalize((front + (left * pp.x)) + (up * pp.y));
    float3 bh = 0.0f.xxx;
    float bhr = 0.20000000298023223876953125f;
    float bhmass = 20.0f;
    bhmass *= 0.001000000047497451305389404296875f;
    float3 p = ro;
    float3 pv = rd;
    float dt = 0.0199999995529651641845703125f;
    float3 col = 0.0f.xxx;
    float noncaptured = 1.0f;
    float3 c1 = float3(0.89999997615814208984375f, 0.3499999940395355224609375f, 0.100000001490116119384765625f);
    float3 c2 = float3(1.0f, 0.800000011920928955078125f, 0.60000002384185791015625f);
    for (float t = 0.0f; t < 1.0f; t += 0.004999999888241291046142578125f)
    {
        p += ((pv * dt) * noncaptured);
        float3 bhv = bh - p;
        float r = dot(bhv, bhv);
        pv += (normalize(bhv) * (bhmass / r));
        float3 param = p - bh;
        float param_1 = bhr;
        noncaptured = smoothstep(0.0f, 0.100000001490116119384765625f, sdSphere(param, param_1));
        float dr = length(bhv.xz);
        float da = atan2(bhv.x, bhv.z);
        float2 ra = float2(dr, ((da * (0.00999999977648258209228515625f + ((dr - bhr) * 0.00200000009499490261077880859375f))) + 6.283185482025146484375f) + (iTime * 0.00200000009499490261077880859375f));
        ra *= float2(10.0f, 20.0f);
        float3 dcol = (lerp(c2, c1, pow(length(bhv) - bhr, 0.5f).xxx) * max(0.0f, tex2D(iChannel1, ra * float2(0.100000001490116119384765625f, 0.5f)).x + 0.0500000007450580596923828125f)) * (4.0f / (0.001000000047497451305389404296875f + ((length(bhv) - bhr) * 50.0f)));
        float3 param_2 = (p * float3(1.0f, 25.0f, 1.0f)) - bh;
        float2 param_3 = float2(0.4000000059604644775390625f, 0.9900000095367431640625f);
        col += max(0.0f.xxx, (dcol * smoothstep(0.0f, 1.0f, -sdTorus(param_2, param_3))) * noncaptured);
        col += (((float3(1.0f, 0.89999997615814208984375f, 0.85000002384185791015625f) * (1.0f.xxx / dot(bhv, bhv).xxx)) * 0.0032999999821186065673828125f) * noncaptured);
    }
    fragColor = float4(col, 1.0f);
}

void frag_main()
{
    float4 outColor = 0.0f.xxxx;
    float2 param_1 = 0.0f.xx;
    float4 param;
    mainImage(param, param_1);
    outColor = param;
    _gl_FragColor = outColor;
}

SPIRV_Cross_Output main()
{
    frag_main();
    SPIRV_Cross_Output stage_output;
    stage_output._gl_FragColor = float4(_gl_FragColor);
    return stage_output;
}

WebGL - this procedure is skipped  :undecided:
Code: [Select]
float sdCappedCylinder( vec3 p, vec2 h )
{
  vec2 d = abs(vec2(length(p.xz),p.y)) - h;
  return min(max(d.x,d.y),0.0) + length(max(d,0.0));
}
« Last Edit: February 05, 2020, 05:41:06 AM by LiaoMi »

Siekmanski

  • Member
  • *****
  • Posts: 2326
Re: Fun with Pixel Shaders and maths
« Reply #42 on: February 05, 2020, 06:30:35 AM »
https://alain.xyz gives a Malware warning....  :sad:
Creative coders use backward thinking techniques as a strategy.

caballero

  • Member
  • *****
  • Posts: 1468
  • Matrix - Noah
    • abre ojos ensamblador
Re: Fun with Pixel Shaders and maths
« Reply #43 on: February 05, 2020, 06:39:17 AM »
"Fun with Pixel Shaders and maths"

Hey guys, don't have fun only you eh?. I'm bussy now, but if you wait, I may do something here,
if providence does not prevent it  :thumbsup:
The logic of the error is hidden among the most unexpected lines of the program

Siekmanski

  • Member
  • *****
  • Posts: 2326
Re: Fun with Pixel Shaders and maths
« Reply #44 on: February 05, 2020, 06:41:20 AM »
 :biggrin: :thumbsup:
Creative coders use backward thinking techniques as a strategy.