Pandoras Box Shader Development

All about PB Automation and custom integration

Moderator: Moderator Group

Pandoras Box Shader Development

Postby Jan Huewel » Tue Apr 10, 2012 7:07 pm

Getting Started with Shaders for Pandoras Box

Hi there,

as we are getting more and more request about shader development, please find below some important information that should get you started with writing shaders for Pandoras Box.

The shaders can be written in HLSL code that is embedded into XML structure and FX files. In order to create and load custom FX files in Pandoras Box please use the file extension ".ccfx"

The shaders need to be copied into the data/fx/shader/ folder structure that can be found in the installation root directory of Pandoras Box.
Please note: you only need to copy your fx files on the Master machine, all connected Client systems will automatically synchronize and download them once they are connected.

Structure of an FX File:
A ccfx File describes the User-Interface parameters and includes the code section of the HLSL code that will be compiled on the fly by the Pandoras Box FX system.

Each FX can be described as a filter, as part of an the FX chain that you can set up for each layer.

In order to access specific values like the previous color of the previous filter / FX output specific Pandoras Box variables can be declared and used, you see these at the beginning of the HLSL Code section of each XML file.

Since the shader Code is embedded in XML you will need to use for signs like ">" "&gt;" and for "<" "&lt;"

The sample files that you can download from this post attachement should give you an idea of how to create basic shaders.

Please note, that writing shaders requires coding and debugging skills. Our support team will be happy to assist you with all user related questions, however debugging and writing shaders is out of the scope of our regular support.
You do not have the required permissions to view the files attached to this post.
Jan Huewel
 
Posts: 260
Joined: Fri Jul 11, 2008 11:49 am
Location: earth

Re: Pandoras Box Shader Development

Postby alverman » Sat Jul 28, 2012 3:19 pm

Is possible have more sources example ?
I found many examples HLSL online but do not contain the function MAIN.
HLSL language is a little difficult for me but maybe with some more example for PB I try to do something.
You Use some development tools to generate code using HLSL or a common wordpad?

Thanks, Alberto
PROService -IT
Intel i7 2600K LGA1155
MB P8H67-MLE 16GB
2xSSD 250GB
GTX470
Win 8.1 PRO
Manager STD V6.1
Player PRO V6.1
WDPro V5 2500
** La famiglia ti nutre, ti veste .... finchè non sei pronto per girare il mondo alla ricerca di qualcosa di tuo. **
User avatar
alverman
 
Posts: 562
Joined: Sat Jun 12, 2010 6:37 pm

Re: Pandoras Box Shader Development

Postby Markus Zeppenfeld » Mon Jul 30, 2012 8:20 pm

Hi Alberto,

unfortunately we do not have more sample code right now. Maybe someone else can share their improvements.
We are as well using just a common wordpad-editor to write the code. Therefore you have an error message in the meantime which is telling you at least the line in which you did something wrong, as soon as the effect cannot be read.

Markus
Markus Zeppenfeld
Senior Product Manager, Pandoras Box

"Have you tried turning it off and on again?" (from "The IT Crowd" / channel 4)
Markus Zeppenfeld
 
Posts: 824
Joined: Wed Mar 02, 2011 10:12 am
Location: Cologne - Germany

Re: Pandoras Box Shader Development

Postby Jan Huewel » Tue Jul 31, 2012 7:15 am

Hi there,
the Pandoras Box shader Engine is based on HLSL.
In general there are many code examples online.
Some are very simple and some are very complex.

In order to implement them into the Pandoras Box xml style shader code the examples of the top post should get you started.
Please be aware that any example you might find on the internet is always depending on the implementation and the features of the context (Render Engine)

For shader development/editing we use Notepad++ and for debugger Pandoras Box does a runtime compilation of the code by refreshing the shader in the FX Tab(right click on it and select refresh), if there is an error in your code the bottom status bar will turn red and you will get some debug information of what type of error was caught in the shader if you click on the status bar.

I hope this helps you getting started.

If you have specific questions please let us know.

Kind regards

Jan Huewel
Jan Huewel
 
Posts: 260
Joined: Fri Jul 11, 2008 11:49 am
Location: earth

Re: Pandoras Box Shader Development

Postby mkohler » Tue Mar 05, 2013 5:32 pm

Hi Jan,

Is there a constant I can refer to get some kind of time counter that always increases? I'd like to make some generator type effects that move over time like the heat haze effects that are built in.

Some directX HLSL forums pointed me to defining a variable as
float time = TIME;
but that seems not to work.

Thanks,

Michael
mkohler
 
Posts: 15
Joined: Mon Nov 30, 2009 9:41 pm

Re: Pandoras Box Shader Development

Postby Jan Huewel » Tue Mar 05, 2013 6:10 pm

Hi there

you can specify a synchronized motion parameter that constantly count up within a specifc range like this

<descripModule type = "paramScalarValue" upper = "65535" lower = "0" hlslType = "float" name = "Speed" hlslName = "speed" default = "32768" artNetWidth = "2" normalize = "true" asMotion="true" minMotion="0" maxMotion="1.0" restrictToRange="true"/>

in this example the value count from 0 to 1 and then starts over from 1
this is a precise way as other wise you might see an error over time when floating point numbers have lower precision when they get to very high values

the following would have nop restriction so the floating point value count unitl its highest possible value and then starts over
<descripModule type = "paramScalarValue" upper = "65535" lower = "0" hlslType = "float" name = "Speed" hlslName = "speed" default = "32768" artNetWidth = "2" normalize = "true" asMotion="true" />

I hope this helps

Kind regards

Jan Huewel
Jan Huewel
 
Posts: 260
Joined: Fri Jul 11, 2008 11:49 am
Location: earth

Re: Pandoras Box Shader Development

Postby buchie » Fri Oct 18, 2013 10:27 pm

Hi Jan,

What will happen if we incorporate DX10 code. Wil it work? The GPU's are ready for it.
The plan is to work in Nvidia FX Composer and copy segments. Do you agree in that approach?
Or would you suggest a different approach in previewing shader effects?

Thanks and best regards,

Michel Buchner
LiveLAB
buchie
 
Posts: 30
Joined: Fri Feb 03, 2012 11:10 pm

Re: Pandoras Box Shader Development

Postby Jan Huewel » Sat Oct 19, 2013 3:24 am

Hi Michel

the current v5 Render Engine is based on DirectX 9c and the pixel & vertex shader support is version 3.0.

Geometry Shaders are currently not supported as this requires to move to a higher DX version which is planed for the future.

Since the shaders are linked dynamically during runtime there is a couple of thing we had to optimize:

One important thing is that in the Aeon FX engine we have introduced our own way of handling texture buffers in order to pass on information from frame to frame.

Multi Pass FX are also possible, but they require a special syntax, due to perfromance optimization we introduced in the FX engine.

This syntax is slightly diffrent from std HLSL syntax.

Since Nvidia FX composer allows you to write arbitrary shaders these might not comply with the Aeon FX structure directly, but if you want to use it to play around with it, you may reuse code you tetsted there.

My recomendation would be to use Notepad++ and Pandoras Box directly in order to evaluate and test shaders.

This is actually the workflow how we create shaders, write the code in Notepad ++ save the file and refresh(recompile) it in Pandoras Box
(by right-clicking in the FX tree on the desired folder or single fx) to see if you get error messages or if the fx does what you intended.

Regarding training on shader programming we have done workshops in the past, but this is usually scheduled on request.

Please let us know if that would be of interesst for you.

Kind regards

Jan Huewel
Jan Huewel
 
Posts: 260
Joined: Fri Jul 11, 2008 11:49 am
Location: earth

Re: Pandoras Box Shader Development

Postby buchie » Sat Oct 19, 2013 12:06 pm

Hi Jan,

Thanks for the shader workshop offer, that's something useful to consider.
Next wednesday I'll have an open discussion with a Unity user to discuss wether to do 3d in PB
or outside PB with Unity and bring it in the system via DVI.

The goal is to have realistic 3d models and make them interactive so you could look at it from all sides,
explode them, etc. The question is, what is the best choice and has a good result with a balanced effort.

I already like the 3d setup of pandora's box, but I would like to enhance the realism in the output.
After some digging I realised how pixel shaders and vertex shaders work in general and it would be
good to focus on the pixel shaders.

When enhancing models, things I'm thinking of are:

- bumpmap
- reflectivity (specular map)
- standard lib materials
- HDRI environment map (which can be hidden and only the effect shown on the object)
- depth of field

a museum could show an interactive 3d collection of objects on peppers ghost, and product presentations
could show interactively how stuff works, but only when the model is convincing in realism.

Concerning particles, if would be great to achieve:

- fire
- lightning effects (streaks, etc)
- simple smoke

These could be attached to a skeleton tracker and can bring extra interactivity to a performance.

Going the unity way is an extra challenge to get it in PB a desirable way, the image becomes flat again.

I think it's an interesting discussion because I believe, although not yet picked up by our community,
3d generation will be key for the future. I see a lot of chances.

I'll keep you posted about our progress,

Thanks and best regards,

Michel Buchner
LiveLAB
buchie
 
Posts: 30
Joined: Fri Feb 03, 2012 11:10 pm

Re: Pandoras Box Shader Development

Postby Jan Huewel » Sat Oct 19, 2013 1:36 pm

Hi Michel

thank you for your input

in general you can use individual objects an animate them on multiple layers in order to get the animation you are looking for, like exploding objects, as long as the count is reasonable.

Another option if you have tons of vertices and lots of detail then you might want to export object sequences as morphtargets from 3d Studio, this allows you to do any kind of animation.

I agree that the following shaders would be great to add:

- bumpmap
- reflectivity (specular map)
- HDRI environment map (which can be hidden and only the effect shown on the object)
- depth of field

I do have these on our shader todo list , too :)

technically all of them could be done with the current engine, one texture sampler that is not yet included in our shader engine is a cubemap sampler which is usefull for hdri texture if they are in a cubemap format
instead you could use spherical maps that can be output by the DomeMaster tool and use these type of maps with the default 2D texture sampler.

for depth of field there is also the possiblity to create gaussian blur based on the distance to the camera view point, this one is a bit complex but not impossible to do.

In general all the requested shaders can be done with the current Aeon FX engine.

Regarding fire and simple smoke with the particle engine, here it is important to use the right textures that give you the result you are looking for.

I have been working a lot with particle illusion in the past and it is quite incredible what you can do with the right mixture of emitters and shapes.

Regarding smoke you could create some prerendered downsampled perlin noise maps and animate 3 or 4 maps on top of each other.

I hope these hints help you finding the right direction

Kind regards

Jan Huewel
Jan Huewel
 
Posts: 260
Joined: Fri Jul 11, 2008 11:49 am
Location: earth

Re: Pandoras Box Shader Development

Postby buchie » Wed Oct 23, 2013 11:40 am

Hi Jan,

Is there a way to find out what the code is behind the cfx files in the fx folder? Or are these files compiled from a different program?
It would be useful to investigate.
If that's not possible for intellectual reasons, are there more examples available in the ccfx format that deals whit a reference to a container (image/x-file)?

We're open to anything,

Thanks and best regards,

Michel
buchie
 
Posts: 30
Joined: Fri Feb 03, 2012 11:10 pm

Re: Pandoras Box Shader Development

Postby Jan Huewel » Thu Oct 24, 2013 2:57 am

Hi Michel

all our cfx files are protected due to software protection reasons.

Since HLSL shaders can be created in many differnt ways it would be good to know what you would like to do in more detail.

please be aware that detailed Shader language support might be beyond the scope of our forum support.

We will try to provide you with as much information as possible. But if you intend to get started with shaders it would be best to organize a workshop and go thru the details in a training.

Kind regards

Jan Huewel
Jan Huewel
 
Posts: 260
Joined: Fri Jul 11, 2008 11:49 am
Location: earth

Jagged edges

Postby buchie » Mon Nov 04, 2013 4:23 pm

Hi Jan,

I was wondering if there is a fix for these jagged edges.

We have tried:
- anti aliasing set to 4x
- several blur, softborder effects, but these apply only to the texture.

No results.

We're busy at the moment with the airscan, and the moment when you rotate a picture or a 3d model you'll see these edges.
(see attached images from a jpg and a 3d model)

Is there a solution inside the software already? or do we need to think of a specially written AAx4 Vertex Shader which can be applied on a container as an effect?

Hope you can shine a light,

Thanks Michel
You do not have the required permissions to view the files attached to this post.
buchie
 
Posts: 30
Joined: Fri Feb 03, 2012 11:10 pm

Re: Pandoras Box Shader Development

Postby Jan Huewel » Mon Nov 04, 2013 5:03 pm

Hi Michel

GPUS perform the anti alias only on the last render pass.

you can do two things:

A) is set your output do bypass
B) try one of the anti alias shaders on your output.

If solution A works for you might turn the Anti-Alias level higher in the nvidia control panel under manage 3D settings, but this will take much more performance then!

Kind regards

Jan Huewel
Jan Huewel
 
Posts: 260
Joined: Fri Jul 11, 2008 11:49 am
Location: earth

Re: Pandoras Box Shader Development

Postby Martina Protze » Tue Jan 07, 2014 4:06 pm

Hello,
please find attached a document that lists all currently available variables from Pandoras Box you can access and use in your shader code
Best regards,
You do not have the required permissions to view the files attached to this post.
Martina Protze
Technical Support, Pandoras Box and Widget Designer
Martina Protze
 
Posts: 199
Joined: Tue Feb 23, 2010 2:47 pm

Next

Return to Integration of 3rd party applications (SDK)

Who is online

Users browsing this forum: No registered users and 2 guests