uRaymarching


https://github.com/hecomi/uRaymarching

hecomiによるUnityでRay marchingやるライブラリ

URPでなぜかライティングされない場合、Rendering PathがForwardになってるか確認しよう

生成されたシェーダファイルのhlslへのパスが相対なので毎回手直ししてるけどどうにかできないのか
Packages/com.hecomi.uraymarching/Runtime/Shaders/Include/UniversalRP/
生成したらその後は直接コードいじった方が楽かも

struct RaymarchInfo
{
    // Input
    float3 startPos;
    float3 rayDir;
    float3 polyPos;
    float3 polyNormal;
    float4 projPos;
    float minDistance;
    float maxDistance;
    int maxLoop;

    // Output
    int loop;
    float3 endPos;
    float lastDistance;
    float totalLength;
    float depth;
    float3 normal;
};

inline void PostEffect(RaymarchInfo ray, inout PostEffectOutput o) の PostEffectOutput は URP の SurfaceData 構造体のこと
シェーダ内に #define PostEffectOutput SurfaceData というマクロがあるから
struct SurfaceData
{
    half3 albedo;
    half3 specular;
    half  metallic;
    half  smoothness;
    half3 normalTS;
    half3 emission;
    half  occlusion;
    half  alpha;
    half  clearCoatMask;
    half  clearCoatSmoothness;
};