Problem with multiple inputs / sequential shaders in flash

Hi,
I'm working with pixelbender for the first time and having a little difficulty understanding a couple of things.
The project is a little flash game with pixel art spaceships, and I've embedded a couple of pixelbender shaders into the swf. I'm writing an editor where you draw an rgba image, the editor infers a greyscale heightmap (at the moment this is done in flash with a blur handcoded using getPixel/setPixel) I use that height map as the source image to make a normal map via a pixel bender shader, I then have another pixelbender shader waiting to take the rgba image and the normal map as two inputs, add a few parameters, with the expected result of a nicely lit sprite output.
The first problem is accessing the result of the normal map shader to pipe it into the lighting shader. The normal map displays perfectly on screen, but my normalMap.bitmapData still contains the unmodified height map image, how do I get at the post-filter image data to send it to the next shader?
The second problem is a bit trickier.. I first thought it was just a minor bug in the pixel bender toolkit, compiling for flash when using multiple source images has an issue where only one source image is scaled. I thought the problem would go away eventually because I am using two identically sized bitmaps for source. However, now that it is in a swf, the output is inside a sprite, and this parent sprite has scale and rotation applied to it. The shader output shows one scaled and rotating image mixed with an unscaled, unrotating image in the top left corner. Even if I make a new sprite, and apply the filter before applying the scale / rotation, the effect persists. This does not seem to effect shaders with a single source - they can be scaled and rotated freely. Is there any solution for this short of ditching the two input shader altogether?
I'm hoping i've missed something simple, but any help at all would be appreciated, thanks.

Sorry for the double post, after a bit of further experimenting I've swapped the order of the two source bitmap parameters, the result is now spectacularly wrong when running as flash within pixelbender, but still fine as GPU or CPU... if someone could tell me exactly why this is breaking it would help a lot with my other problems:
<languageVersion : 1.0;>
kernel dotLight
<namespace : "com.bludgin"; vendor : "Bludgin"; version : 1; description : "vector based directional lighting";>
input image4 rgbmap;
input image4 nmlmap;
output pixel4 dst;
parameter float ang< minValue:0.0; maxValue:6.283; defaultValue: 0.0;>;
parameter float3 lgt1 <minValue: float3(0.0, 0.0, 0.0); maxValue: float3(5.0, 5.0, 5.0); defaultValue:float3(1.0, 1.0, 1.0); >;
parameter float elev<minValue:-2.0; maxValue:2.0; defaultValue:0.5;>;
parameter float spread<minValue:-1.0; maxValue:5.0; defaultValue:1.0;>;
parameter float amb<minValue:-0.0; maxValue:1.0; defaultValue:0.2;>;
parameter float clip<minValue:-1.0; maxValue:1.0; defaultValue:0.0;>;
void evaluatePixel() {
dst = sampleNearest(nmlmap,outCoord())-0.5;
pixel4 col = sampleNearest(rgbmap,outCoord());
float4 light = float4(cos(ang), sin(ang),elev,spread);
float dp = dot(normalize(light),normalize(dst));
dp = max(dp,clip);
dst = float4(  col.r*amb + col.r*dp*lgt1.r,
                col.g*amb + col.g*dp*lgt1.g,
                col.b*amb + col.b*dp*lgt1.b,
                col.a);
a couple of test images to try with it:
http://evilbastard.org/slight/shipTestNormal.png
http://evilbastard.org/slight/shipTestRGB.png

Similar Messages

  • Problem with multiple forms and subview

    I have a problem when using NetBean Web Pack (JDK6, Net Beans 5.5, JSF 1.2).
    1) I created a JSF page (hello.jsp) and a page fragment (header.jspf) inside Web Pack, and let the JSF page (hello.jsp) includes the page fragment.
    2) The include instruction is outside of the "form" element id=main_form() of the first JSF page.
    3) Inside the page fragment (header.jspf), I put a form (id=header_form) with some input fields inside the "subview" element.
    4) When running the web application, the form and its children (id=header_form) inside the subview are not rendered.
    It seems to be a problem with multiple forms on a page and the subview.
    Do I use these JSF components incorrectly? Any advice?
    Thanks

    The forms are not nested.
    hello.jsp
    <webuijsf:body ...>
    <!-- BEGIN: include header -->
    <div style="margin: 0px 0px 10px 0px; left: 0px; top: 0px">
    <jsp:directive.include file="Header.jspf"/>
    </div>
    <!-- END: include header -->
    <webuijsf:form ...>
    From above fragment, you can see the header.jspf is outside of the form element.

  • Problem with multiple Toplink/JPA apps in same server

    Anyone have experence of running serveral Toplink/ EJB-3 Web apps in the same server (OC4J, alas)?
    We seem to get a problem with the second app failing to initialise toplink, with an entity not found message. Each app runs OK on it's own.

    Yes, they access the same datasource and most of the tables overlap.
    We're thinking it might help to have common entity classes and put them in a shared library, but I don't know if this is relevant (setting up shared libraries complicates testing and tends to snowball, I reckon we need about 15 jars all told).
    I''ve had some funnies on OC4J before which I think may be to do with it's use of ClassLoaders, for example I initially put persistence.xml in the libary jar with the data model, but for some reason I get the entity not found error that way. It only seems to work if it's in the classes folder.
    For the moment we're getting arround the problem with multiple OC4J instances in the server.

  • A problem with importing layered PSD file into Flash

    Hi.
    There's a problem with importing layered PSD file into Flash.
    If I import a layered PSD file, some part the color of the lower layer is shown at the edge of objects or shadows. Instead, if I crop each layers first and import them, there's no problem.
    If the higher layer has brush or transparent effects, it becomes worse.
    Any help with this problem?
    Thanks.

    How was the original art created? Was the original RGB or CMYK? What is the resolution of the Photoshop file? Flash only works well with RGB and 72 pixel per inch resolution. If your original art is not set this way, then Flash will attempt to convert it as it imports it. Flash uses the sRGB color space. You'll get the best color translation if your Photoshop file is using this color preference.

  • Problem with the input file format to be stored in database

    Hi,
    I am facing some problem with the input format. I am using the table name as data.employee. But i could not able to process the message forward. I am getting this error,
    com.ibm.db2.jcc.c.SqlException: java.sql.Connection.close() requested while a transaction is in progress on the connection.The transaction remains active, and the connection cannot be closed.
    Can you please help me prposing a solution for this format.
    Thanks,
    SOorya

    I think you are missing out the COMMIT operation.
    At the DB2 end before closing the connection if you do a 'COMMIT' then this may remove your error.
    i.e. after you close the Resultset>close the statement object> perform 'COMMIT' operation--> then close the connection.
    Also refer :-
    http://www.dbforums.com/archive/index.php/t-976407.html
    http://www.dbforums.com/showthread.php?t=1628183
    I hope this will help you.
    Thanks,
    Vijaya

  • Problem with multiple versions of documents being published with 001, 002, etc.

    I am using Contribute CS3. I am having a problem with multiple versions of documents being published on the sever with 001, 002, etc in the name. So that I end up with 2 or 3 versions of a document on the server. Does anyone know why / how Contribute  is doing this? Thanks for any help you can give.

    Your Web site administrator will need to update your key to allow you to delete files you are able to edit.

  • Problems with multiple idocs in one file ( Inbound file )

    HI,
    Thanks in Advance for your suggestions.. Highly appreciated.
    We have problems with multiple IDocs in one file.
    We are using XIB ( Amtrix ) as Middleware to receive the files.
    Curretenly When the file contains one IDoc then there is no problem. IDoc is created and everything is ok.
    If file contains two IDocs ( for example two messages ORDERS and DELVERY ) then it is creating two IDocs but both IDocs contains ORDERS plus DELIVERY segements information. That is the problem. Some how SAP unable to differentiate the IDocs in the file.. But it knows that how many idocs are there in the file..because it is creating exact number of idocs.
    We are using TRFC port ... Do I need to change it to File port..
    When we have more than one idoc do we need set any parameter in the file ...

    Thanks for the swift response. Always ideas are useful.
    As of now , Middleware cannot split the file.
    Thing is SAP is creating two Idocs with different message types. Problem is First IDoc contains ORDERS message type but also DELIVERY segments as well. Second IDoc with DELIVERY message tyoe but ORDERS segments as well... This is the problem... I think we are missing some field activation in file for EDIDC record.
    As far as I know file port supports the number of IDocs in one file.. Hope TRFC port also supports that

  • I am having problems with certain websites that require adobe flash player because of the restrictions that apple has put in place. Is there a way to get to sites that require flash player?

    I am having problems with certain websits that require adobe flash player

    Please don't start the 1 millionth thread on this subject, which has been answered over and over and over and over and over and over and over.........Use the search bar and type flash and you'll see thousands of posts on this.

  • JSP FORMS WITH MULTIPLE INPUT ROWS

    HI,
    I NEED USE A FORM IN JSP WITH MULTIPLE INPUT ROWS TO IMPLEMENT A SALES ITEM PROGRAM.
    I HAVE TRIED WITH INSTRUCTIONS -- WHILE AND DO.. WHILE -- BUT TOMCAT 4.0 DOES NOT PROCESS THEM CORRECTLY BECAUSE IS IN A DEAD LOCK.
    ANY BODY CAN HELP ME?

    Thank you. But i don?t use caps lock. My program look like this:
    <form method="pos" action="echo.jsp">
    <table align="center" cellpadding="0" cellspacing="0" border="1" width="100%" bgcolor="#ffffff">
    <tr>
    <th class="titulo3">C?digo</th>
    <th class="titulo3">Descripci?n</th>
    <th class="titulo3">Nivel seguridad</th>
    <th class="titulo3">Moldes</th>
    <th class="titulo3">j</th>
    </tr>
    <%
    do {                    
    %>                                   
    <tr>
    <td class="titulo3">
    <input name="codigo" type="text" size="10" maxlength="10">               
    </td>
    <td class="titulo3">
    <input name="nombre" type="text" size="30" maxlength="100">               
    </td>          
    <td class="titulo3">
    <SELECT NAME="codopc" >                         
         <OPTION VALUE="nivel1"> Nivel 1                
         <OPTION VALUE="nivel2"> Nivel 2      
         <OPTION VALUE="nivel3"> Nivel 3
         <OPTION VALUE="nivel4"> Nivel 4
         <OPTION VALUE="nivel5"> Nivel 5           
    </SELECT>                                    
    </td>     
    <td class="titulo3">
    <input name="moldes" type="checkbox" size="30" maxlength="20">          
    </td>     
    <td class="titulo3">
    <input name="moldes" type="text" size="10" maxlength="20" value="<%= j %>">     
    </td>                                   
    </tr>               
    <%
    } while ( newlines );
    %>                                        
    </table>
    ....... more code about submit and clear buttons...
    </form>

  • LOV Problem with multiple values

    HI All,
    I have a problem with LOV .When ever i click LOV after search button all values are displaying fine.
    But when i get so many values i want to select only one vlaue that is not cmng to the main page ....Cursor is in running state always after that time out error is coming in my application .
    This problem is coming with with only single value selection in lOV only problem with Multiple values retrival that time only...
    (Iam using 11.1.1.3 Jdeveloper.)
    Thanx in advance...

    duplicate of {thread:id=2286814}

  • Pixelated video and upscaling problems with ringing artifacts on Youtube since Flash player 10.3

    Pixelated video and upscaling problems with ringing artifacts on Youtube since Flash player 10.3. Flash palyer 10.2 was the last version without the listed problems.
    For anyone interested you may see here what 'ringing artifacts' means : http://en.wikipedia.org/wiki/Ringing_artifact
    More about Image artifacts/errors related to video scaling here :  http://en.wikipedia.org/wiki/Video_scaler
    Test configuration :
    Windows 7 x64
    Intel HD Graphics with lastest available drivers from manufacturer.
    Any solution from Adobe?

    Could you please open a new bug report on this over at bugbase.adobe.com?  Please post back with the URL so that others affected can add their comments and votes.
    Thanks,
    Chris

  • I have a problem with FF 4.0b8 and Adobe Flash player where portions of the YouTube page or FF window will black out when I move my curser over buttons or tabs, etc. Any suggestions?

    I'm running FF 4 Beta 8 with the latest Flash player (10.1.102.64). When I play YouTube videos, the video is loaded, starts, and plays okay, but when I move my cursor around within the Firefox window, portions of the window black out under where the cursor travels. FF tabs and buttons will black out, or parts of the YouTube page (but not the video). CTL-ALT-Del to bring up Windows Security Panel, then CANCEL will restore the Firefox window, plus the YouTube page correctly (ie black is gone and window has been redrawn correctly). I can open up new tabs and replicate the problem multiple times. I've also experienced this problem with embedded YouTube videos (though it's easiest to replicate the problem direct from the YouTube page.) I don't experience this problem at all with FF 4 Beta 8 in Safe Mode, nor the latest FF 3.x.x. I have tried uninstalling and re-installing the Flash plug-in. Anyone have any ideas?

    Problem involving videos played from the YouTube site is much less noticeable after upgrading from FF 4.0b8 to 4.0b9, but still occurs with embedded YouTube videos, where blacking out of other portions of the window still happens.

  • Problem with multiple transparent JPanels

    Hi,
    I'm currently trying to implement some kind of message box that can fade in and out. This message box is a subclass of JComponent, the message it contains can be an arbitrary Swing-Component.
    The message container and the message itself have the same background color. When fading, the (partly transparent) colors of the of the container and the message are added, which I do not want.
    Here are two images to illustrate my problem:
    What I have: http://www.inf.tu-dresden.de/~ab023578/javaforum/reality.gif
    What I want: http://www.inf.tu-dresden.de/~ab023578/javaforum/wish.gif
    Here is the code:
    import java.awt.*;
    import javax.swing.*;
    public class Main {
        static float transparency = 0f;
        public static void main(String[] args) {
            JPanel jpBack = new JPanel() {
                protected void paintComponent(Graphics g) {
                    Graphics2D g2d = (Graphics2D)g;
                    g2d.clearRect(0, 0, getWidth(), getHeight());
                    g2d.setColor(getBackground());
                    AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, transparency);
                    g2d.setComposite(alpha);
                    g2d.fillRect(0, 0, getWidth(), getHeight());
            jpBack.setBackground(Color.WHITE);
            jpBack.setLayout(null);
            JPanel jpContainer = new JPanel();
            jpContainer.setBackground(Color.RED);
            jpContainer.setLayout(null);
            JPanel jpMessage = new JPanel();
            jpMessage.setBackground(Color.RED);
            JLabel jlMessage = new JLabel("MESSAGE");
            jpBack.add(jpContainer);
            jpContainer.add(jpMessage);
            jpMessage.add(jlMessage);
            jpContainer.setBounds(10, 10, 120, 100);
            jpMessage.setBounds(10, 10, 100, 50);
            JFrame frame = new JFrame();
            frame.setBounds(0, 0, 150, 150);
            frame.setBackground(Color.WHITE);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setContentPane(jpBack);
            frame.setVisible(true);
            for (double a = 0; true; a += 0.01D) {
                try {
                    Thread.sleep(10);
                catch (InterruptedException e) {}
                transparency = (float)Math.abs(Math.sin(a));
                jpBack.repaint();
    }I understand that the Porter-Duff-Rule SRC_OVER causes the container to be drawn over the message (or vice versa) and both of them over the background. I think what I need is a way to handle the whole jpContainer-Panel and all its subcomponents as a single source image. Is that possible?

    Thank you for your answer, Sarcommand. Unfortunately the test program I provided is a bit too simple as your solution works here but not for my original problem. :|
    Let me explain what I want to achieve and why.
    I'm writing a tool for algorithm visualisation. Currently I am dealing with a parsing algorithm (having compontents such as an automaton with an input tape, output tape and a stack). Those components (containers) can contain multiple JComponents (GraphicalObjects), which display a BufferedImage that can be altered during the animation.
    I want to create my message windows the same way. A container that contains GraphicalObjects (or, if necessary, any other Swing component). One GraphicalObject has a very limited field of responsibility: mereley displaying its information.
    Aligning the GraphicalObject is one of the container's responsibilities.
    What I'm currently trying to do is to put my GraphicalMessage into the center of a container, leaving an offset on the left/right/upper/lower side. This is why I need the same background color for both the GraphicalMessage and the MessageContainer, I don't want the user to see that there are actually two JComponents on top of each other.
    While I could use another approach for text messages I prefer this one as I would be able to fade arbitrary Containers and their GraphicalObjects .
    Here is the code:
    import java.awt.*;
    import javax.swing.*;
    import java.awt.image.BufferedImage;
    public class Main {
        static float transparency = 0f;
        public static void main(String[] args) {
            JPanel jpBack = new JPanel() {
                protected void paintComponent(Graphics g) {
                    Graphics2D g2d = (Graphics2D)g;
                    g2d.clearRect(0, 0, getWidth(), getHeight());
                    g2d.setColor(getBackground());
                    AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, transparency);
                    g2d.setComposite(alpha);
                    g2d.fillRect(0, 0, getWidth(), getHeight());
                    super.paintComponent(g);
            jpBack.setBackground(Color.WHITE);
            jpBack.setLayout(null);
            JPanel jpContainer = new JPanel();
            jpContainer.setBackground(Color.RED);
            jpContainer.setLayout(null);
            GraphicalMessage msg = new GraphicalMessage();
            jpBack.add(jpContainer);
            jpContainer.add(msg);
            jpContainer.setBounds(10, 10, 120, 100);
            msg.setBounds(10, 10, 160, 60);
            JFrame frame = new JFrame();
            frame.setBounds(0, 0, 150, 150);
            frame.setBackground(Color.WHITE);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setContentPane(jpBack);
            frame.setVisible(true);
            float stepSize = 0.01f;
            float step = stepSize;
            for (float a = 0; true; a += step) {
                try {
                    Thread.sleep(10);
                catch (InterruptedException e) {}
                if (a >= 1) {
                    step = -stepSize;
                    a -= stepSize;
                if (a <= 0) {
                    step = stepSize;
                    a += stepSize;
                    msg.updateInternalContent();
                    msg.redraw();
                transparency = a;
                jpBack.repaint();
    class GraphicalMessage extends JComponent {
        private String text;
        private Graphics2D ig2d;
        private BufferedImage image;
        public GraphicalMessage() {
            setLayout(null);
            image = new BufferedImage(100, 50, BufferedImage.TYPE_INT_ARGB);
            ig2d = image.createGraphics();
            ig2d.setColor(Color.BLACK);
            ig2d.setBackground(Color.RED);
            ig2d.setFont(new Font("Courier New", Font.BOLD, 20));
            updateInternalContent();
            redraw();
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2d = (Graphics2D)g;
            g2d.drawImage(image, 0, 0, null);
        public void redraw() {
            ig2d.clearRect(0, 0, image.getWidth(), image.getHeight());
            ig2d.drawString(text, 0, 20);
        public void updateInternalContent() {
            text = String.valueOf((int)(Math.random() * 10000));
    }A possibility to erase the text from the BufferedImage without having to draw a rectangle would help me as well.

  • Problem with multiple applications using one audio output

    Hey there, I'm having issues setting up my 5.1 headset seen here (http://www.sharkoon.com/?q=en/content/x-tatic-digital) to work with multiple applications.
    Right now I have audio streaming from a flash video, when I try run "$ speaker-test -c 6" I get the following error:
    speaker-test 1.0.25
    Playback device is default
    Stream parameters are 48000Hz, S16_LE, 6 channels
    Using 16 octaves of pink noise
    ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave
    Playback open error: -16,Device or resource busy
    If I try open another application which uses this device, the first application has its sound cut off.
    2 more things to note:
    - My preference for setup would be audio output through S/PDIF and input through USB, with the USB output disabled (To not waste system resources).
    - I unmuted all channels in ALSA, however when I ran the test only 2 channels seemed to be working (Front L&R), it may have been defaulting to the USB connection, in which case, that explains only 2 channels being in use, is there a method of setting the S/PDIF as default system wide?
    Thanks in advance for any help given!

    brebs wrote:It's put the comments on multiple lines - fix that.
    Woops, I guess my paste messed up, new .asoundrc: http://pastie.org/3706033
    I can run both at the same time, however I cannot hear any audio. Do I somehow have to change the default device, if so how can I do that?
    Edit:
    Restarted system now I get:
    speaker-test 1.0.25
    Playback device is default
    Stream parameters are 48000Hz, S16_LE, 2 channels
    Using 16 octaves of pink noise
    Rate set to 48000Hz (requested 48000Hz)
    Buffer size range from 2048 to 8192
    Period size range from 1024 to 1024
    Using max buffer size 8192
    Periods = 4
    was set period_size = 1024
    was set buffer_size = 8192
    0 - Front Left
    Segmentation fault
    (That's with both commands)
    EDIT 2:
    Interesting, apparently 2 audio streams are working, however the console thing still doesn't work..?
    EDIT 3:
    Didn't last long, now flash crashes and html 5 doesn't work -.-
    EDIT 4:
    Flash only works when other audio is active, however it has constant popping sound. I went through the system logs to get the errors of when flash crashes, it's audio crashing it, here's the error:
    Apr  1 02:04:15 localhost kernel: [ 7057.499787] AudioThread[6227]: segfault at 7f2e2f7a8008 ip 00007f2e413a2786 sp 00007f2e33614ae8 error 7 in libasound.so.2.0.0[7f2e4131e000+eb000]
    Last edited by B3NW (2012-04-01 01:11:04)

  • Safari 5.0.4 Problem with multiple overlaying plugins

    Hi!
    I experience an issue only in Safari on a webpage with multiple overlaying plugins. The overlaying plugin will not render in the browser. For instance, on the mainpage there is a flash-banner. When logging in it opens an iFrame overlaying the banner. This login-frame contains java, but Java will not render or load in Safari. Everything is ok in other browsers and a peculiar thing is that the problem only occurs in Safari on certain types of Macs like MacbookPro and iMac. The ordinary MacBook displays everything ok.
    The problem must be related to plugins overlaying cause if i resize or zoom in the browser, it may render. If i go to another subpage without the flash-banner, the java-login appears ok. On another subpage it opens an iFrame containing Flash, but the background is also flash. The same problem again. Flash in the iFrame won`t render.
    A workaround is to make Java open in its own process (through the Java control panel), but this aint good since all MacBookPro- and iMac-users have to do this. Flash doesn`t have this option either.
    When Safari 5.0.4 was released, the changelog said: "Improved stability for webpages with multiple instances of plug-in content".
    Updates Safari on several different Macs, but the problem consists.
    Anyone know anything about this?

    Hi,
    I use ClickToFlash to get around the overlays.
    http://clicktoflash.com/
    Gives you complete control over Flash content.
    Carolyn

Maybe you are looking for