Environment Mapping with Irrlicht

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Environment Mapping with Irrlicht

Post by Mel »

Long time i didn't release an irrlicht demo!....

Image

These are the results of my experiments with the spherical mapping. Actually, the advantages of using a single texture to generate environment maps are many, compared to the potential drawbacks (even if they are as little or ignoreable as this technique has) They can be stored on texture atlases and a single texture could be used to store many at the same time, without the need of texture arrays, for instance.

This demo also features IImage manipulation. An aspect that i think is overlooked on the main examples, as it is somehow left as a secondary tool, and a helper, as Irrlicht mainly focuses on the hardware drivers, leaving the software manipulation abandoned. For instance, a filtered 2D reading from the software images could be a nice feature to add. And many other things i sure forget to mention.

Also, there is code for both OpenGL and DirectX, so, in theory, the demo should be able to compile and run under any environment, i haven't provided any projects, only a windows executable, a compiled, unmodified, version of Irrlicht, the data directory, which just uses some of the media files from the Irrlicht distribution, and the source code in the source directory. Any part of it is freely useable.

http://omegasection.g0dsoft.com/backup/ ... rlicht.zip

Anyway! i hope you find them interesting!
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
thanhle
Posts: 325
Joined: Wed Jun 12, 2013 8:09 am

Re: Environment Mapping with Irrlicht

Post by thanhle »

Hi Nice stuff,
This at the moment seems to work only on OpenGL NVidia graphic card. DirectX doesn't work, it said could not load D3DXAssemleShader from dll.

Intell card doesn't work in openGL nor DirectX. My graphic card is GTX 860M 4Gb.

Regards
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Environment Mapping with Irrlicht

Post by Mel »

The source is there for you to compile your own version. If Irrlicht on DirectX works properly on your system you can try that :) Create a project on your preferred work environment (code::blocks, DevC++, Visual Studio Express...) add that source code, link the irrlicht library and you should be done with ease.

Anyway, i also would recomend you to install a DirectX9C redistributable because that DLL error seems to be more like a missing D3D9 lib.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Environment Mapping with Irrlicht

Post by The_Glitch »

Looks good works on my d3d9 driver. I'll look into this if it takes nadro along time to add cubemap support.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Environment Mapping with Irrlicht

Post by Mel »

I hope you find my code useful. The cubemap support shouldn't be too hard to implement on DX either. The interfaces are ready, the only thing left is to write the proper cubemap generation.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Environment Mapping with Irrlicht

Post by Vectrotek »

I tried running the app, but my system says no go..(no permission).
I have Windows XP and Nvidia card. What is the problem?
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Environment Mapping with Irrlicht

Post by Nadro »

Hi Mel,

I see a following issue in OpenGL:
GLSL shader failed to compile
Fragment shader failed to compile with the following errors:
ERROR: 0:16: error(#143) Undeclared identifier: atan2
ERROR: 0:16: error(#202) No matching overloaded function found: atan2
ERROR: error(#273) 2 compilation errors. No code generated
Do you have a NV card? NV drivers are problematic for develop OpenGL...(atan2 isn't available in GLSL, this is the same situation like with a float4 etc, IIRC you can avoid those problems by adding '#version 110' or higher - NV drivers works better if you provide '#version').

Anyway this demo looks really nice, thanks for share it! :)

Cheers,
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: Environment Mapping with Irrlicht

Post by devsh »

using trigonometric functions in rendering code is a grave sin
chronologicaldot
Competition winner
Posts: 688
Joined: Mon Sep 10, 2012 8:51 am

Re: Environment Mapping with Irrlicht

Post by chronologicaldot »

devsh wrote:using trigonometric functions in rendering code is a grave sin
I guess that makes me the devil. lol. jk
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Environment Mapping with Irrlicht

Post by Mel »

Trigonometrics are there for some reason, and so far i've never found a justification to the ATAN2 operation in shader language other than the spherical mapping.

In fact, it is perfectly posible to create another environment mapping solution which won't use the trigonometrics at all, and will look the same, the only diference would be the distribution of the pixels in the final skysphere, but the final result would be almost the same looking.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Environment Mapping with Irrlicht

Post by Nadro »

Maybe this will be helpful for someone here, so the latest trunk rev has support for cubemaps in both OGL and D3D9 :)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Environment Mapping with Irrlicht

Post by Mel »

Nice! I think it would be an important addition as well to create materials that used the cubemaps directly with the engine, so people at least knew there is support for them, but it is a great job, none the less :)

This, the support for flexible vertex formats, and the instancing would definitely cover some of the gaps that Irrlicht needs to fill.

EDIT:
By the way, this is USING CUBEMAPS, no extra stuff, no extra nothing. REAL cubemaps
Image

So, good work, NADRO! :)

I will release another demo as soon as I implement the other shaders :P
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Environment Mapping with Irrlicht

Post by Nadro »

Thanks, good to see that it works fine :) At now shader-pipeline is slightly behind of trunk with features, however after v1.9 will be released (I hope that we'll be able to push this version soon) I immadiately merge changes from trunk to shader-pipeline or even maybe merge shader-pipeline into trunk.

BTW. In upcoming days I'll add support for load cubemaps directly from PVR files (IVideoDriver::getTexture).
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Environment Mapping with Irrlicht

Post by The_Glitch »

Okay great looking forward to latest changes.
chronologicaldot
Competition winner
Posts: 688
Joined: Mon Sep 10, 2012 8:51 am

Re: Environment Mapping with Irrlicht

Post by chronologicaldot »

Yay! Thanks Nadro!
Post Reply