Jump to content

[Solved] Fog in C++?


Roland
 Share

Recommended Posts

Hi

 

What's needed to get the Fog shader included in Shadmar's PP-shader pack working in C++.

 

I thought this was the only thing to do but the result is no fog at all. Adding the fog to the editor works and gives a nice fog, but only in the editor

 

auto cam = reinterpret_cast<Camera*>(lb.getEntity("cam")); // this is my camera
cam->AddPostEffect("Shaders/PostEffects/02_pp_fog_by_klepto.lua");
cam->SetKeyValue("fog_fogrange", "0,20");
cam->SetKeyValue("fog_fogcolor", "0.57,0.53,0.55,1.0");
cam->SetKeyValue("fog_fogangle", "5,21");
cam->SetKeyValue("fog_fogislocal", "0");

 

In editor

post-395-0-52870500-1487845961.png

 

In C++ program

post-395-0-75874300-1487845970.png

AV MX Linux

Link to comment
Share on other sites

Solved now.

I created the camera in C++ instead of loading a camera created in the editor and then it works.

 

auto cam = Camera::Create();
cam->AddPostEffect("Shaders/PostEffects/02_pp_fog_by_klepto.lua");
cam->SetKeyValue("fog_fogrange", "0,20");
cam->SetKeyValue("fog_fogcolor", "0.57,0.53,0.55,1.0");
cam->SetKeyValue("fog_fogangle", "5,21");
cam->SetKeyValue("fog_fogislocal", "0");

  • Upvote 3

AV MX Linux

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...