TUTORIAL How to only show objects during race

Discussion in 'Tracks' started by Gunnar333, Feb 12, 2021.

  1. Gunnar333

    Gunnar333 Well-Known Member

    Joined:
    Aug 5, 2017
    Messages:
    321
    Likes Received:
    618
    Location:
    Germany
    So here is what I found out about this CSP Spectators settings and how we can use it for not even spectators with a work around.

    So what does these settings do? Let's see it as 3 modes:

    mode 1 (default):
    mode1.png
    in race mode you can see spectators that are defined in camera_facing.ini
    in practice mode these spectators are hidden
    doesn't effect [SPECTATORS] parameter in ext_config

    mode 2:
    mode2.png
    in race mode you can see spectators that are defined in camera_facing.ini
    in practice mode these spectators are also shown.
    doesn't effect [SPECTATORS] parameter in ext_config

    mode 3 ("Adjust amount of spectators" tick doesn't matter):
    mode3.png
    in race mode spectators that are defined in camera_facing.ini are hidden.
    in practice mode these spectators are also hidden.
    meshes defined in ext_config like this:
    Code:
    [SPECTATORS]
    meshes=people01, people02, people03
    are also hidden.

    I asume most people will use mode1 so hiding meshes with [SPECTATORS] option doesn't make much sense.
    But how can we hide an object like a cameraman or a parked safety car in practice mode?
    Well here is another CSP option we can use which will allow the following work around:

    define a condition
    Code:
    [CONDITION_...]
    NAME=SPECTATORS_EVENT
    INPUT=SPECTATORS
    LUT=(|0=0|0.5=0|0.5=1|1=1|)
    So we get a on/off condition depending on spectator amount
    Use it to change material alpha values like this:

    Code:
    [SHADER_REPLACEMENT_...]
    DESCRIPTION=replace ksDiffuse Shader
    MESHES=mesh01, mesh02, mesh03
    SHADER=ksPerPixelAlpha
    BLEND_MODE=ALPHA_TEST
    
    [MATERIAL_ADJUSTMENT_...]
    MESHES=mesh01, mesh02, mesh03
    CONDITION=SPECTATORS_EVENT
    KEY_0 = alpha
    VALUE_0 = 1
    VALUE_0_OFF = 0
    KEY_1 = ksAlphaRef
    VALUE_1 = 0.5
    VALUE_1_OFF = 2
    
    In shader replacement we replace the shader from a normal ksPerPixel shader to ksPerPixelAlpha so we will be able to set an alpha value in material adjustment.
    Changing BlendMode to Alpha test might also be needed for transparent obects.

    in material adjustment:
    alpha value = 0 makes the material transparent so the mesh is hidden but still we can see its shadow.
    With ksAlphaRef = 2 (value largen than 1) we can hide the shadow, too

    I will use this for an updated Norisring (release later today on RD) where I hide cameras, 3Dpeople, cranes, small tents, camping chairs, etc in practice mode.
    So you can have a look at it how it works.







     
  2. JrC

    JrC Active Member

    Joined:
    Feb 2, 2021
    Messages:
    216
    Likes Received:
    130
    Location:
    Canada
    That is really cool. Thank you for the detailed breakdown! Im gonna give it a try at Vancouver!
     
  3. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,117
    Likes Received:
    379
    mh it would be cool to remove stuff with this, but i am afraid its only invisible and not really removed from rendering-pipeline, i guess - and i might be wrong - its just hidden.

    In case you intended that stuff is just not there in practice thats a valid way to do it!
    Though i dont see many reasons over lowering world details and using ...KSLAYERX names...
     
    Last edited: Feb 13, 2021
  4. Johnr777

    Johnr777 Moderator

    Joined:
    Jul 26, 2017
    Messages:
    1,050
    Likes Received:
    614
    Nice write up!

    To add: input=spectators can also be used to control any additional crowd sounds from custom soundbanks.

    Current limitations: this won’t work with skinned mesh objects, like animated people.
     
  5. Gunnar333

    Gunnar333 Well-Known Member

    Joined:
    Aug 5, 2017
    Messages:
    321
    Likes Received:
    618
    Location:
    Germany
    Thanks! Good to know.
    So no skinned animation.

    But it works on "standart" animation like helicopter movement
     
  6. Gunnar333

    Gunnar333 Well-Known Member

    Joined:
    Aug 5, 2017
    Messages:
    321
    Likes Received:
    618
    Location:
    Germany
    Yes. That's right. Objects are still there, only hidden. I tried different ways to get them out of the rendering pipeline but without success.

    It is not meant for performance reaaons. Just visual.
    But you can combine it with kslayerx of course
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice