IBL Shaders material animation by texture swapping

Discussion in 'Car Modding' started by 3377, Aug 17, 2023.

  1. 3377

    3377 Registered

    Joined:
    Oct 16, 2010
    Messages:
    100
    Likes Received:
    54
    Hello,

    In the old Rf2 shaders, you could swap textures to animate a material, it was useful for rotating parts like rim.

    If you had multiple textures like "rim", "rim00"; "rim01"; "rim02" (the texture having more radial blurry to simulate speed) you could make Rf2 switch between the 3 numbered rim textures and I could see the blurred textures when pausing the game in a straight on a track

    However with the new ibl shaders (ibl standard) it doesn't work anymore, or i am not able to do ut. Only the first non blurred texture is used (only the texture called "rim"... the game doesn't switch between textures. Is it possible to do it with the IBL standard shader ?

    I see we can translate the uvw map from material editor, but it's not what I want

    I know it's possible for the ibl tire shaders and it work... but I can't manage to do it for the standard ibl shaders. What parameters do I need to edit in my json file ?

    Thanks.
     
    Last edited: Aug 17, 2023
    Manfredk2 likes this.
  2. redapg

    redapg Registered

    Joined:
    Jan 16, 2012
    Messages:
    4,027
    Likes Received:
    2,886
    @3377 You say that the IBL Tire Shader manages it.
    So you can generate a JSON File that works with Texture Animation.
    Did you do that and then compare it with a JSON File from a Standard IBL Material, to see the Differences?
    That is what i would do, as first Step.
    It probably are only a few Lines that you have to add, to get it working with a Standard IBL Material JSON too.

    EDIT But such Things should be manageable, directly in the Editor. (Hint, Hint :))
     
    3377 likes this.
  3. 3377

    3377 Registered

    Joined:
    Oct 16, 2010
    Messages:
    100
    Likes Received:
    54
    Thanks for the answer!

    Well I tried to compare the 2 json (ibl standard and tires) yesterday evening and tried to add lines that to me were revelant but it made my game crash during loading. Maybe I didn't do the things correctly

    I will look at the editor against. I seen animation was possible but only by scrolling the uvw map option.

    Anyways I'll look at it tonight in the editor :)
     
  4. svictor

    svictor Registered

    Joined:
    Jan 20, 2019
    Messages:
    937
    Likes Received:
    6,382
    A while ago I have wrote a sequenced animation guide for IBL shader here:
    https://forum.studio-397.com/index....-opensource-free-software.70938/#post-1085292

    And one important thing to note:
    When in Dev mode and has opened a material that has "sequenced animated" in material editor, as soon as you change any parameter in material editor, the animation will stop playing (animation isn't lost), and the only way to resume animation is to reload the track. Hence once you have done material modification in material editor, reload the track again to have animation play.
     
    3377 and Corti like this.
  5. 3377

    3377 Registered

    Joined:
    Oct 16, 2010
    Messages:
    100
    Likes Received:
    54
    Thanks for all this info
    I know I did not put a skipframeparameter. Maybe that's why it crashed. I'll see tonight

    Then by quoting :
    ""Method":"CUBETAM_CYCLE", is the type of animation, there are total 6 types (info extracted from UI file), which are Cycle,Pendulum,One Shot,Transient,Random,Manual. For normal looping animation, only Cycle is needed, which writes as CUBETAM_CYCLE."

    Where is the UI file describing these parameters? Random should be good for rims? I want blur depending on the quickness of the rim speed. I'll look also in the tire json to see what was chosen on this section for the tire. It should also work there
     
    svictor likes this.
  6. svictor

    svictor Registered

    Joined:
    Jan 20, 2019
    Messages:
    937
    Likes Received:
    6,382
    Random should work.

    I just recalled there is also an easier way to do it. First you need to assign IBL shader to rim material in 3Dsimed (or 3dsmax), then add animation sequence to corresponding Channels (albedo, Nm, Mr, etc) in 3Dsimed editor and save GMT, the limitation is that you need to know which channel corresponds to which material types (may need to test in game to see). Once done, load car & track in dev mode, then find & open material in material editor, and click save button to save material JSON file. This way you will have fully functional animation sequence without manual editing JSON.

    For example, this IBL tyre material guide uses 3dsimed to setup animation sequence in a tradition way, and material JSON can be exported & saved using material editor:
    https://forum.studio-397.com/index....tyre-shader-pbr-materials-for-old-mods.71365/
     
    Last edited: Aug 17, 2023
    3377 likes this.
  7. 3377

    3377 Registered

    Joined:
    Oct 16, 2010
    Messages:
    100
    Likes Received:
    54

    It worked by editing the json file :)
    Thank you very much! Problem solved.

    When the car has not started :
    standing.png

    At low speed :
    launching.png

    At full speed :
    fullspeed.png


    However in the json the method to use is : "Method":"CUBETAM_RANDOM", as "CUBETAM_CYCLE" did not done the job. The rim animation was a cycle with no point in common with the rim speed.

    And there is my working json if anybody want to take it as a base. I use the animation only on the albedo texture, with a 3 file sequence :

    {
    "dstBlend":"CUBEAB_ZERO",
    "flags":[
    "CUBEMAT_AMBIENTMAT",
    "CUBEMAT_DIFFUSEMAT",
    "CUBEMAT_SPECLARDIR",
    "CUBEMAT_EMISSIVMAT",
    "CUBEMAT_EMISSIVDIR"
    ],
    "name":"F1L90S_RIM_OZ",
    "parameters":{
    "StandardInfo":{
    "ambientColour":[
    1,
    1,
    1,
    1
    ],
    "blendPercent":0,
    "bumpScale":1,
    "cubeMapFresnel":{
    "Exp":4,
    "Max":1,
    "Min":0
    },
    "diffuseColour":[
    1,
    1,
    1,
    1
    ],
    "emissiveColour":[
    0,
    0,
    0,
    1
    ],
    "refEnhance":0,
    "specFresnel":{
    "Exp":4,
    "Max":1,
    "Min":0
    },
    "specPower":1,
    "specularColour":[
    1,
    1,
    1,
    1
    ]
    },
    "cbParameters":{
    "Material_Adjust":{
    "AlbedoTint":[
    1,
    1,
    1,
    1
    ],
    "Metallic":0.5,
    "NormalIntensity":1,
    "NormalShadowInfluence":0.5,
    "Roughness":0.5,
    "Specular":0.7
    },
    "UV_Scale":{
    "Albedo":[
    1,
    1
    ],
    "MetalRough":[
    1,
    1
    ],
    "Normal":[
    1,
    1
    ],
    "aoSpec":[
    1,
    1
    ]
    }
    }
    },
    "preprocessorFlags":{
    "ALBEDOMAP":"@Null",
    "ALBEDOUV":"UV_A",
    "AOSPECALTMAP":"@Undef",
    "AOSPECALTUV":"UV_A",
    "AOSPECMAP":"@Null",
    "AOSPECUV":"UV_A",
    "BILLBOARD":"@Undef",
    "DETAILALBEDO":"@Null",
    "DETAILALBEDOBLEND":"@Undef",
    "DETAILAO":"@Undef",
    "DETAILMAP":"@Undef",
    "DETAILMETALLIC":"@Undef",
    "DETAILNORMAL":"@Undef",
    "DETAILROUGHNESS":"@Undef",
    "DETAILSPEC":"@Undef",
    "DETAILUV":"UV_B",
    "EMISSIVEMAP":"@Undef",
    "EMISSIVEMODE":"@Undef",
    "EMISSIVEUV":"UV_C",
    "METALLICROUGHNESSMAP":"@Null",
    "METALROUGHUV":"UV_A",
    "NORMALMAP":"@Null",
    "NORMALUV":"UV_A",
    "RETROREFLECTOR":"@Undef",
    "TRANSLUCENCY":"@Undef",
    "TRANSLUCENCYALBEDO":"@Undef",
    "VERTEXALPHA":"@Undef",
    "VERTEXCOLOR":"@Undef"
    },
    "refName":"",
    "shader":"L2IBLSTANDARD",
    "sortOffset":0,
    "srcBlend":"CUBEAB_ONE",
    "textures":[
    {
    "AnisoLevel":0,
    "ChromaColor":0,
    "Flags":[
    "CUBETF_OWNEDBYMATERIAL"
    ],
    "FrameCount":3,
    "Method":"CUBETAM_RANDOM",
    "MipBias":0,
    "MipLevels":1,
    "Name":"albedoMap",
    "Rate" : 1,
    "Sequence" : [
    0,
    1,
    2
    ],
    "ShaderPass":0,
    "ShadowMipBias":0,
    "SkipFrame0":false,
    "StageType":"CUBETST_SRGB",
    "TexChannel":0,
    "Texture":"Rims_OZ",
    "hasDefault":true,
    "inactive":false,
    "runtime":false
    },
    {
    "AnisoLevel":0,
    "ChromaColor":0,
    "Flags":[
    "CUBETF_OWNEDBYMATERIAL"
    ],
    "FrameCount":1,
    "MipBias":0,
    "MipLevels":1,
    "Name":"aoSpecularMap",
    "ShaderPass":0,
    "ShadowMipBias":0,
    "StageType":"CUBETST_LINEAR",
    "TexChannel":0,
    "Texture":"Rims_aos",
    "hasDefault":true,
    "inactive":false,
    "runtime":false
    },
    {
    "AnisoLevel":0,
    "ChromaColor":0,
    "Flags":[
    "CUBETF_OWNEDBYMATERIAL"
    ],
    "FrameCount":1,
    "MipBias":0,
    "MipLevels":1,
    "Name":"metalRoughMap",
    "ShaderPass":0,
    "ShadowMipBias":0,
    "StageType":"CUBETST_LINEAR",
    "TexChannel":0,
    "Texture":"Rims_mr",
    "hasDefault":true,
    "inactive":false,
    "runtime":false
    },
    {
    "AnisoLevel":0,
    "ChromaColor":0,
    "Flags":[
    "CUBETF_OWNEDBYMATERIAL"
    ],
    "FrameCount":1,
    "MipBias":0,
    "MipLevels":1,
    "Name":"normalMap",
    "ShaderPass":0,
    "ShadowMipBias":0,
    "StageType":"CUBETST_LINEAR",
    "TexChannel":0,
    "Texture":"Rims_nm",
    "hasDefault":true,
    "inactive":false,
    "runtime":false
    }
    ]
    }
     
    svictor and Emery like this.

Share This Page