Home › Forums › Programming › Fog in JavaScript / WebGL
Tagged: fog
- This topic has 18 replies, 4 voices, and was last updated 4 years, 7 months ago by Yuri Kovelenov.
-
AuthorPosts
-
2019-09-16 at 12:11 pm #18822GLiFTeKCustomer
Hi
I’ve been using layers of low transparency black color emission material to simulate black fog while experimenting with certain ideas.I’d like to implement ACTUAL simulated fog now though.
I’ve read the manual instructions on how to implement webgl into our .js files and understood it by experimenting with that.
I’ve looked at the manual page on FOG but don’t quite understand as there’s not an example given (excuse my n00bness).
I’ve looked around the web, but most of the material i find isn’t quite reproducible, as it’s not in the context of the Verge3D configuration of things.
Does anyone know of a quick snippet that’s compatible with the Verge3D ‘arrangement of things’ that I could place into my .js file to simulate simple black fog?
thanks.
Visit the GLIFTEK Verge3D Plugins Store!
GLIFTEK.com for Plugin Documentation & LIVE DEMOS!
LIKE The GLIFTEK Facebook Page for updates!
Join the Verge 3D Discord Server!
plz share Discord link & on your signature!2019-09-16 at 1:20 pm #18842Yuri KovelenovStaffcheck out this example https://cdn.soft8soft.com/demo/examples/index.html?q=fog#webgl_geometry_terrain_fog
2019-09-16 at 3:15 pm #18890GLiFTeKCustomeryeah that’s the first one i looked at.
all i saw was a tanish-pink screen and nothing changed.
but now the fog CLEARS and i see mountains.. ahhhhahah.
thanks!
I’ll see what i can do with this.Visit the GLIFTEK Verge3D Plugins Store!
GLIFTEK.com for Plugin Documentation & LIVE DEMOS!
LIKE The GLIFTEK Facebook Page for updates!
Join the Verge 3D Discord Server!
plz share Discord link & on your signature!2019-09-17 at 6:47 am #18902Yuri KovelenovStaff2019-09-25 at 3:40 pm #19277GLiFTeKCustomerso…
still struggling with implementing this in the .js file.
in the source for that example at github here
there’s all the terrain and mouse interaction code in the script within the html…
but if i JUST want the code, it should be a very simple line like the one i find there..
scene.fog = new v3d.FogExp2(0xefd1b5, 0.0025);
i’ve put that, like i do other external js call code after the “hello there” part of our .js file.
and i call js function “fog” and to no avail..i also deleted “scene” and had it just “fog” and newp.
also tried doing something like..
app.ExternalInterface.fog = new v3d.Fog(black, 0.0025, 5);
and
app.ExternalInterface.fog = new THREE.Fog(0x000000, 0.0025, 5);
which i found on other samplesbut no.
I used to use javascript alot long ago.. and am probably in need of a refresher course, but i am stumped at this, as it seems so simple.thanks
Visit the GLIFTEK Verge3D Plugins Store!
GLIFTEK.com for Plugin Documentation & LIVE DEMOS!
LIKE The GLIFTEK Facebook Page for updates!
Join the Verge 3D Discord Server!
plz share Discord link & on your signature!2019-09-26 at 7:23 am #19309Yuri KovelenovStaff2019-09-27 at 2:00 am #19350GLiFTeKCustomerHi,
Try making it
app.scene.fog = new v3d.FogExp2(0xefd1b5, 0.0025);
place this line inside the runCode() function in your app js file.hmm..
not working..
tried it in a diff app also. (also updated my v3d.js and ammo.js in both)
i also tried it in firefox and chrome.
here’s the whole code i have in my runcode area..function runCode(app) { // add your code here, e.g. console.log('Hello, World!'); app.ExternalInterface.removeObject = function(objName) { var obj = app.scene.getObjectByName(objName); obj.parent.remove(obj); } app.scene.fog = new v3d.FogExp2(0xefd1b5, 0.0025); }
what should be called in the JScall function puzzle field? just “fog” ? or should i not use one? ( i also tried “app.scene.fog” and “scene.fog” and “FogExp2” and “v3d.Fogexp2” in the Js Call function puzzle.
Do we have to identify it as a function somehow?
Visit the GLIFTEK Verge3D Plugins Store!
GLIFTEK.com for Plugin Documentation & LIVE DEMOS!
LIKE The GLIFTEK Facebook Page for updates!
Join the Verge 3D Discord Server!
plz share Discord link & on your signature!2019-09-27 at 2:56 am #19353GLiFTeKCustomeri also tried to set it up like the removeObject function with variables for the parameters…
function runCode(app) { // add your code here, e.g. console.log('Hello, World!'); app.ExternalInterface.removeObject = function(objName) { var obj = app.scene.getObjectByName(objName); obj.parent.remove(obj); } app.ExternalInterface.fog = function(color, factor) { app.scene.v3d.FogExp2(color, factor); } }
with these puzzles –
Visit the GLIFTEK Verge3D Plugins Store!
GLIFTEK.com for Plugin Documentation & LIVE DEMOS!
LIKE The GLIFTEK Facebook Page for updates!
Join the Verge 3D Discord Server!
plz share Discord link & on your signature!2019-09-27 at 4:28 am #19357GLiFTeKCustomeralso i tried this with the puzzles
app.ExternalInterface.fog = function(color, factor) { app.scene.fog = new v3d.FogExp2(color, factor); }
Visit the GLIFTEK Verge3D Plugins Store!
GLIFTEK.com for Plugin Documentation & LIVE DEMOS!
LIKE The GLIFTEK Facebook Page for updates!
Join the Verge 3D Discord Server!
plz share Discord link & on your signature!2019-09-27 at 10:32 am #19400GLiFTeKCustomerusing this now.
app.ExternalInterface.fogA_v3d_FogExp2 = function() { app.scene.fog = new v3d.FogExp2(0x0000ff,0.05); } app.ExternalInterface.fogB_v3d_Fog = function() { app.scene.fog = new v3d.Fog(0x0000ff,1,10); } app.ExternalInterface.fogA2_v3d_FogExp2 = function(color,factor) { app.scene.fog = new v3d.FogExp2(color,factor); } app.ExternalInterface.fogB2_v3d_Fog = function(color,near,far) { app.scene.fog = new v3d.Fog(color,near,far); }
2 with variables in them.
2 that need them named.with the puzzles..
you just click on one of 4 cubes to trigger their JS calls.
pretty sure that should all work right?
Visit the GLIFTEK Verge3D Plugins Store!
GLIFTEK.com for Plugin Documentation & LIVE DEMOS!
LIKE The GLIFTEK Facebook Page for updates!
Join the Verge 3D Discord Server!
plz share Discord link & on your signature!2019-09-27 at 10:35 am #19404Alexander KovelenovStaff2019-09-27 at 12:06 pm #19410GLiFTeKCustomerHi,
we’ve just supported fog in all Verge3D materials. Check out the upcoming release!in the new Verge3D 2.15 pre3?
Visit the GLIFTEK Verge3D Plugins Store!
GLIFTEK.com for Plugin Documentation & LIVE DEMOS!
LIKE The GLIFTEK Facebook Page for updates!
Join the Verge 3D Discord Server!
plz share Discord link & on your signature!2019-09-27 at 12:51 pm #19413Yuri KovelenovStaff2019-10-01 at 1:42 pm #19652Yuri KovelenovStaff2020-04-17 at 8:51 pm #26005doehlmaCustomerHello Yuri,
can you tell me please where I can find it the fog in Verge3D materials?
whch I also bought ..Best regards,
Marcus -
AuthorPosts
- You must be logged in to reply to this topic.