Shaders and Texture3D

Hello all,



I’m experimenting with shaders at the moment. The most examples I’ve found are working with 3D Textures.

I saw that there is a Texture3D class in JME and there is also a DDSLoader class. But the DDS Loader doesn’t support Volume textures, right?

Are there plans to support this widely used 3d texture format?



Is anybody working with 3d textures and the JME Texture3D class? I would appreciate any information or experiences of other JME users.

Is there a way to load volume textures in JME?



Thanks and greetings

Hi!



I think volume textures are fragment shaders. If you write a fragment shader program, so there will be a 3d texture like clouds or turbulent noise.



About texture3d class in jme i don’t know.



PS: If you will write an interesting shader for public release (GPL) so please contact me to put it my repository. I develop and collect shaders for JME. :slight_smile:



http://code.google.com/p/jme-glsl-shaders/ - this is my repository.

mifth said:
PS: If you will write an interesting shader for public release (GPL) so please contact me to put it my repository. I develop and collect shaders for JME. :)

For which there is still no plugin in the official library :/

I would like to make an official library, but I cannot compile NBM module. When I create a module I have no “Generate xml Layer” checkbox.



I generated layer xml through right-click “new wizard”, but I have no luck.



My log, when I try to compile nbm:



taskdefs:

common-init:

projectized-common.basic-init:

basic-init:

files-init:

nbm-license-init:

Created dir: /home/mifth/jMonkeyProjects/shaderblow/shaderblow-library/build

build-init:

Scanning for modules in /home/mifth/jmonkeyplatform/jmonkeyplatform

Scanning for modules in /home/mifth/jmonkeyplatform/harness

Scanning for modules in /home/mifth/jmonkeyplatform/java

Scanning for modules in /home/mifth/jmonkeyplatform/extra

Scanning for modules in /home/mifth/jmonkeyplatform/ide

Scanning for modules in /home/mifth/jmonkeyplatform/platform

Scanning for modules in suite /home/mifth/jMonkeyProjects/shaderblow

init:

up-to-date:

compile:

Created dir: /home/mifth/jMonkeyProjects/shaderblow/shaderblow-library/build/classes

Compiling 1 source file to /home/mifth/jMonkeyProjects/shaderblow/shaderblow-library/build/classes

Copying 15 files to /home/mifth/jMonkeyProjects/shaderblow/shaderblow-library/build/classes

jar-prep:

jar:

Building jar: /home/mifth/jMonkeyProjects/shaderblow/build/cluster/modules/jme-shaderblow.jar

netbeans-extra:

module-xml-regular:

module-xml-autoload:

module-xml-eager:

javahelp:

module-auto-deps:

release:

chmod-executables:

verify-class-linkage:

1 file(s) have been successfully validated.

netbeans:

Generating information for Auto Update…

BUILD SUCCESSFUL (total time: 2 seconds)

Well that looks like a successful compile, can you install the nbm?

But i have no NBM. Only jme-shaderblow.jar is compiled. :frowning:

Layer.xml looks like:



[xml]<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">

<filesystem/>

[/xml]

Right-click the project and select “create nbm’s”

Thanks, I knew about it. I removed my module-suite and made new one. And it compiled! I think there were some dependencies problems.



Now I’ve got another problem. When I install my NBM… it’s installed, but I cannot see my module in “Installed” plugins. I dont know how to solve it.

Hey guys,



thanks for your reply and your interesting discussion. :wink:



My problem is not the code for the glsl shader. There are a lot of examples, e.g. http://www.3dshaders.com/home/

I’m not able to import or create a volume texture to use most of these example shader in JME. Additionally I’m not sure, if JME supports volume textures at all?! I don’t want to dig deep in the opengl code to use these fragment shaders…



Any other suggestions on this topic!?



Thanks

Have a look at glsl water filter. possibly it will be helpful.



It uses in code wave scale, amplitude, etc:

[java]



FilterPostProcessor fpp = new FilterPostProcessor(assetManager);

final WaterFilter water = new WaterFilter(rootNode, lightDir);

water.setWaterHeight(-20);

water.setUseFoam(false);

water.setUseRipples(false);

water.setDeepWaterColor(ColorRGBA.Brown);

water.setWaterColor(ColorRGBA.Brown.mult(2.0f));

water.setWaterTransparency(0.2f);

water.setMaxAmplitude(0.3f);

water.setWaveScale(0.008f);

water.setSpeed(0.7f);

water.setShoreHardness(1.0f);

water.setRefractionConstant(0.2f);

water.setShininess(0.3f);

water.setSunScale(1.0f);

water.setColorExtinction(new Vector3f(10.0f, 20.0f, 30.0f));

fpp.addFilter(water);

viewPort.addProcessor(fpp);[/java]

There is no Texture 3D in the water filter. They are not fully supported in JME3, @Kaelthas gave it a try last week http://hub.jmonkeyengine.org/groups/contribution-depot-jme3/forum/topic/texture3d/ but it seems he didn’t succeed.



Also someone posted a patch a long time ago, http://hub.jmonkeyengine.org/groups/contribution-depot-jme3/forum/topic/texture3d/

Maybe it’s time to get it in the core…

look at this post for Texture3D in jme 3

http://hub.jmonkeyengine.org/groups/general-2/forum/topic/3d-textures-1/#post-138691



I found a nice software to create DDS 3D texture here

http://blog.murderdev.com/?tag=/texture3d

1 Like

@gimlinho Loading DDS Volume texture is now supported see this example for usage : http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/texture/TestTexture3DLoading.java?spec=svn8003&r=8003

1 Like

@nehon Thank you for your very interesting input on this topic. That’s exciting and I will give it a try as soon as possible. Unfortunately we’re still working with JME2, so maybe now is the time for us to upgrade…

I will share my experiences on this topic here. Thanks again.

Oh ok, I thought that was JME3. Maybe you can take the JME3 DDSLoader and port it back to jme2…