RW Statistical Spectrum and RW Object Splash

Post Reply
CG_Nema
Posts: 67
Joined: Fri May 31, 2013 5:23 am

RW Statistical Spectrum and RW Object Splash

Post by CG_Nema » Sun Jul 07, 2013 1:25 am

When using Statistical Spectrum to add waves to a Realwave, any object splash emitter connected to an object colliding with the RW causes the splash particles at the waterline to generate in the wrong position.

I've tried it many different ways and concluded there is no easy way around this.

Either way, I would love any tips on how to get particles generated at the real waterline of the Realwave/Object intersection. I even tried using the waterline module in python but the particles are generated in the same place with that method. If any experts have ideas on a workaround for this, I would be very thankful.

-Nema
You do not have the required permissions to view the files attached to this post.

User avatar
Alex
Site Admin
Posts: 143
Joined: Mon Jun 14, 2010 9:35 am

Re: RW Statistical Spectrum and RW Object Splash

Post by Alex » Sun Jul 07, 2013 10:38 am

Hi,

You are right, the waterline seems not to be computed properly when there is choppiness in the waves.

The problem is a bit too much complex to be fixed quickly.

Please, let us think about the best workaround in this case. (Not at the office right now)
Maybe we can do something using graphs and distance fields.

Sorry for the inconvenience.
Alex Ribao
RealFlow Team
Next Limit Technologies

User avatar
Alex
Site Admin
Posts: 143
Joined: Mon Jun 14, 2010 9:35 am

Re: RW Statistical Spectrum and RW Object Splash

Post by Alex » Mon Jul 08, 2013 11:59 am

Hi again,

after some testing, we believe there is a (terribly slow) way to make it work.

The trick is pasting the following graph in the FramesPre stage:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<scene>
    <nodes>
        <node>
            <name>GetRealWaveMesh_01</name>
            <type>GetRealWaveMesh</type>
            <inputs/>
        </node>
        <node>
            <name>GetRealWaveAsHeightfieldImage_01</name>
            <type>GetRealWaveAsHeightfieldImage</type>
            <inputs>
                <input>
                    <name>search radius</name>
                    <type>real</type>
                    <value>5</value>
                </input>
                <input>
                    <name>border epsilon</name>
                    <type>real</type>
                    <value>0.1</value>
                </input>
                <input>
                    <name>image resolution</name>
                    <type>integer</type>
                    <value>64</value>
                </input>
                <input>
                    <name>color scale</name>
                    <type>real</type>
                    <value>1</value>
                </input>
                <input>
                    <name>tiled</name>
                    <type>bit</type>
                    <value>false</value>
                </input>
            </inputs>
        </node>
        <node>
            <name>Evaluator_02</name>
            <type>Evaluator</type>
            <inputs>
                <input>
                    <name>evaluate</name>
                </input>
            </inputs>
            <outputs/>
        </node>
        <node>
            <name>SetRealWaveMeshFromImage_01</name>
            <type>SetRealWaveMeshFromImage</type>
            <inputs>
                <input>
                    <name>scale xyz</name>
                    <type>vector3</type>
                    <value>0.000000,1.000000,0.000000</value>
                </input>
                <input>
                    <name>tiled</name>
                    <type>bit</type>
                    <value>false</value>
                </input>
            </inputs>
        </node>
        <node>
            <name>RealWaveMeshUpdate_01</name>
            <type>RealWaveMeshUpdate</type>
            <inputs>
                <input>
                    <name>face normals</name>
                    <type>bit</type>
                    <value>true</value>
                </input>
                <input>
                    <name>vertex up</name>
                    <type>bit</type>
                    <value>true</value>
                </input>
                <input>
                    <name>vertex normals</name>
                    <type>bit</type>
                    <value>true</value>
                </input>
                <input>
                    <name>bounding box</name>
                    <type>bit</type>
                    <value>true</value>
                </input>
                <input>
                    <name>depth map</name>
                    <type>bit</type>
                    <value>true</value>
                </input>
            </inputs>
        </node>
        <node>
            <name>ImageConvert_02</name>
            <type>ImageConvert</type>
            <inputs>
                <input>
                    <name>color depth</name>
                    <type>list</type>
                    <value>32 bits</value>
                </input>
                <input>
                    <name>channels</name>
                    <type>list</type>
                    <value>3 Channels</value>
                </input>
                <input>
                    <name>alpha value</name>
                    <type>real</type>
                    <value>1</value>
                </input>
                <input>
                    <name>mapping</name>
                    <type>list</type>
                    <value>0..1 -> -1..1</value>
                </input>
            </inputs>
        </node>
    </nodes>
    <connections>
        <connection>
            <source>root.SetRealWaveMeshFromImage_01.out mesh</source>
            <target>root.RealWaveMeshUpdate_01.mesh</target>
        </connection>
        <connection>
            <source>root.ImageConvert_02.out image</source>
            <target>root.SetRealWaveMeshFromImage_01.image</target>
        </connection>
        <connection>
            <source>root.RealWaveMeshUpdate_01.out mesh</source>
            <target>root.Evaluator_02.evaluate</target>
        </connection>
        <connection>
            <source>root.GetRealWaveAsHeightfieldImage_01.out image</source>
            <target>root.ImageConvert_02.image</target>
        </connection>
        <connection>
            <source>root.GetRealWaveMesh_01.mesh</source>
            <target>root.SetRealWaveMeshFromImage_01.mesh</target>
        </connection>
        <connection>
            <source>root.GetRealWaveMesh_01.mesh</source>
            <target>root.GetRealWaveAsHeightfieldImage_01.mesh</target>
        </connection>
    </connections>
    <layout>
        <nodes>
            <node>
                <name>root.GetRealWaveMesh_01</name>
                <position>792.075682,-379.517926</position>
                <color>0.572000,0.654647,0.880000</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
            <node>
                <name>root.GetRealWaveAsHeightfieldImage_01</name>
                <position>1151.699951,-511.450562</position>
                <color>0.572000,0.654647,0.880000</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
            <node>
                <name>root.Evaluator_02</name>
                <position>2281.682917,-330.154950</position>
                <color>0.572000,0.828667,0.880000</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
            <node>
                <name>root.SetRealWaveMeshFromImage_01</name>
                <position>1730.000122,-391.538483</position>
                <color>0.572000,0.654647,0.880000</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
            <node>
                <name>root.RealWaveMeshUpdate_01</name>
                <position>1998.977417,-403.234192</position>
                <color>0.572000,0.654647,0.880000</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
            <node>
                <name>root.ImageConvert_02</name>
                <position>1450.875244,-495.413940</position>
                <color>0.572000,0.880000,0.643867</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
        </nodes>
        <notes/>
    </layout>
</scene>
That graph transforms the RealWave from a choppiness mesh to a pure height field.
Unfortunately, the process can be really slow.

The 'search radius' parameter affects the amount of time, but it needs to be kind of high to be able to "see" all the walls of the wave.
The 'image resolution' affects greatly the performance. I would recommend you to try first with a small value. If the waterline is too unaccurate then you can always try to increase it later.

You can run it once for every frame and save the sequence of images as EXR files. Like in this graph:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<scene>
    <nodes>
        <node>
            <name>GetRealWaveMesh_01</name>
            <type>GetRealWaveMesh</type>
            <inputs/>
        </node>
        <node>
            <name>GetRealWaveAsHeightfieldImage_01</name>
            <type>GetRealWaveAsHeightfieldImage</type>
            <inputs>
                <input>
                    <name>search radius</name>
                    <type>real</type>
                    <value>5</value>
                </input>
                <input>
                    <name>border epsilon</name>
                    <type>real</type>
                    <value>0.1</value>
                </input>
                <input>
                    <name>image resolution</name>
                    <type>integer</type>
                    <value>64</value>
                </input>
                <input>
                    <name>color scale</name>
                    <type>real</type>
                    <value>1</value>
                </input>
                <input>
                    <name>tiled</name>
                    <type>bit</type>
                    <value>false</value>
                </input>
            </inputs>
        </node>
        <node>
            <name>Evaluator_02</name>
            <type>Evaluator</type>
            <inputs>
                <input>
                    <name>evaluate</name>
                </input>
            </inputs>
            <outputs/>
        </node>
        <node>
            <name>ImageConvert_02</name>
            <type>ImageConvert</type>
            <inputs>
                <input>
                    <name>color depth</name>
                    <type>list</type>
                    <value>32 bits</value>
                </input>
                <input>
                    <name>channels</name>
                    <type>list</type>
                    <value>3 Channels</value>
                </input>
                <input>
                    <name>alpha value</name>
                    <type>real</type>
                    <value>1</value>
                </input>
                <input>
                    <name>mapping</name>
                    <type>list</type>
                    <value>0..1 -> -1..1</value>
                </input>
            </inputs>
        </node>
        <node>
            <name>ImageSave_01</name>
            <type>ImageSave</type>
            <inputs/>
        </node>
        <node>
            <name>StringFilePathCompose_01</name>
            <type>StringFilePathCompose</type>
            <inputs>
                <input>
                    <name>name</name>
                    <type>string</type>
                    <value>height</value>
                </input>
                <input>
                    <name>extension</name>
                    <type>string</type>
                    <value>exr</value>
                </input>
                <input>
                    <name>extension order</name>
                    <type>list</type>
                    <value>name_#.ext</value>
                </input>
                <input>
                    <name>padding</name>
                    <type>integer</type>
                    <value>5</value>
                </input>
            </inputs>
        </node>
        <node>
            <name>FolderName</name>
            <type>String</type>
            <inputs>
                <input>
                    <name>in</name>
                    <type>string</type>
                    <value>$(SCENEDIR)/images</value>
                </input>
            </inputs>
        </node>
        <node>
            <name>GetCurrentFrameTime_01</name>
            <type>GetCurrentFrameTime</type>
            <inputs/>
        </node>
    </nodes>
    <connections>
        <connection>
            <source>root.GetRealWaveMesh_01.mesh</source>
            <target>root.GetRealWaveAsHeightfieldImage_01.mesh</target>
        </connection>
        <connection>
            <source>root.GetRealWaveAsHeightfieldImage_01.out image</source>
            <target>root.ImageConvert_02.image</target>
        </connection>
        <connection>
            <source>root.ImageSave_01.through</source>
            <target>root.Evaluator_02.evaluate</target>
        </connection>
        <connection>
            <source>root.FolderName.out</source>
            <target>root.StringFilePathCompose_01.folder</target>
        </connection>
        <connection>
            <source>root.StringFilePathCompose_01.file path</source>
            <target>root.ImageSave_01.file path</target>
        </connection>
        <connection>
            <source>root.ImageConvert_02.out image</source>
            <target>root.ImageSave_01.image</target>
        </connection>
        <connection>
            <source>root.GetCurrentFrameTime_01.frame</source>
            <target>root.StringFilePathCompose_01.frame</target>
        </connection>
    </connections>
    <layout>
        <nodes>
            <node>
                <name>root.GetRealWaveMesh_01</name>
                <position>792.075682,-379.517926</position>
                <color>0.572000,0.654647,0.880000</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
            <node>
                <name>root.GetRealWaveAsHeightfieldImage_01</name>
                <position>1156.449483,-449.706642</position>
                <color>0.572000,0.654647,0.880000</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
            <node>
                <name>root.Evaluator_02</name>
                <position>2284.849272,-336.487660</position>
                <color>0.572000,0.828667,0.880000</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
            <node>
                <name>root.GetCurrentFrameTime_01</name>
                <position>1287.123235,-603.190594</position>
                <color>0.838808,0.880000,0.572000</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
            <node>
                <name>root.FolderName</name>
                <position>1373.114115,-701.598150</position>
                <color>0.643867,0.880000,0.572000</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
            <node>
                <name>root.StringFilePathCompose_01</name>
                <position>1602.823719,-633.566910</position>
                <color>0.643867,0.880000,0.572000</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
            <node>
                <name>root.ImageConvert_02</name>
                <position>1455.624776,-433.670021</position>
                <color>0.572000,0.880000,0.643867</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
            <node>
                <name>root.ImageSave_01</name>
                <position>1893.282309,-370.550666</position>
                <color>0.619033,0.572000,0.880000</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
        </nodes>
        <notes/>
    </layout>
</scene>
That way you can reuse the output images the next time, which will be much faster.

Let us know if it works for you, or if you get stalled at some point.
Alex Ribao
RealFlow Team
Next Limit Technologies

CG_Nema
Posts: 67
Joined: Fri May 31, 2013 5:23 am

Re: RW Statistical Spectrum and RW Object Splash

Post by CG_Nema » Mon Jul 08, 2013 11:51 pm

This is great Alex, I will start testing it with my scene soon. Will post results once I have something good.

Thanks very much!

-Nema

CG_Nema
Posts: 67
Joined: Fri May 31, 2013 5:23 am

Re: RW Statistical Spectrum and RW Object Splash

Post by CG_Nema » Tue Jul 16, 2013 11:26 pm

So after trying this out in a few different test scenes, I found that it was better to just generate the splash with a 0.0 choppiness RW, then cache the particles and resim with choppiness, the speed : accuracy ratio was best using that method. The main reason is that the graph wouldn't apply any waves generated by object interaction or particle interaction, and it was very slow. I appreciate the effort very much though, the way I did it still looks great and was quite fast.

Thanks!

-Nema
You do not have the required permissions to view the files attached to this post.

Post Reply