Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. Knowledge Base
  3. 3D Blocks
  4. Add Fog to a Scene

Add Fog to a Scene

Scheduled Pinned Locked Moved 3D Blocks
1 Posts 1 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • CreatiCodeI Offline
    CreatiCodeI Offline
    CreatiCode
    wrote on last edited by admin
    #1

    Introduction

    Fog is a lighting effect that adds transparent color to objects, and the further away an object is from the camera, the less visible it becomes.

    Fog can not only make your scene look more realistic, but also help hide objects far away, which makes it fun for the player to explore your scene.

    To add the fog effect, you can use the following block:

    0919c944-a205-4bab-8155-7b3679d76d36-image.png

     
     

    Fog Type

    There are 2 types of fog you can choose from.

    • Linear: The linear range inputs will be used to specify where the fog will start and end based on the distance to the camera. Objects nearer than the “start” distance will not be covered by the fog at all, and objects further away than the “end” distance will be completely covered.
    • Exponential: The “density” input will be used to specify the density of the fog based on the distance. All objects will be somewhat covered by the fog color, and the further away they are, the more invisible they become.

     
     

    Fog Color

    This is the color of the fog. You can use a high brightness value for day time fog, and a low brightness for nighttime.

    fec09ee6-cd8f-4e47-8756-5eeaee986f54-image.png

    5b1bd260-60e6-41c7-afdc-478ef14af9be-image.png

     
     

    Linear Range - Start and End

    These 2 numbers are only used when the fog type is “linear”. Suppose their values are 1000 and 3000. That means:

    • Any object within a distance of 1000 to the camera will not be affected by the fog color at all.
    • Any object at a distance of 3000 or more will be completely covered up by the fog
    • Objects at distances between 1000 and 3000 will gradually become invisible inside this range.

    For example, this program adds 3 boxes at distances of about 500/1000/1500 from the camera. When we add a fog that begins at 500 distance and ends at 1500 distance, the nearest box is not affected by the fog at all, while the furthest box becomes hidden.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/dabc6d2e-9d2a-469d-a65a-60215fbcc851.gif" width="1000" style="border-radius: 5px; border: 1px solid #29622d;">

     
     

    Density (For Exponential Type of Fog)

    When the fog type is “exponential”, the linear range will be ignored, because all objects at all distances will be somewhat covered by the fog color. Instead, the “density” value controls how quickly the density of the fog grows with distance.

    Here is a comparison of different density values:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/dba74a79-0cd0-470b-8ca0-003353a548b1.gif" width="1000" style="border-radius: 5px; border: 1px solid #29622d;">

    1 Reply Last reply
    0

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode