WARNING : This site is outdated and the PopcornFX team will no longer answer your questions here.
For all support questions please go to our Discord server
0 like 0 dislike

Very simple effect, perhaps an easy solution awaits! Steps to reproduce:

I've got a very basic ribbon using a 4x4 atlas whose spawner script calls for a random TextureID (0,15).

I've got a TextureUField entry called "RibbonU" established in the evolver like such:

    RibbonU = LifeRatio *10 - scene.Time* 5;

Expected Results:

I wanted a ribbon whose texture is stretched over the length of the ribbon, scrolling, whose sprites are chosen at random from an atlas.

Experienced Results:

I'm... not sure? It appears to be having a hard time determining which sprite to render, although it IS rendering frames from the atlas at regular, appropriate intervals.

Have I set up something incorrect in my ribbon or am I asking Popcorn to do something it doesn't want to do?

Thanks in advance!

The Problem

(hopefully the image loads, if not I can comment in the thread and try again)


by SevenCubed (200 points)

1 Answer

0 like 0 dislike

The ribbon renderer doesn't work like that unfortunately.

Each segment of the ribbon is drawn between two particles.

Each quad/segment uses the TextureID from the first particle to determine what sub-rect to use when drawing.

It uses the other properties of each particle for the rest (UField, Color, axes, etc...)

So when you setup the RibbonU to scroll across the ribbon, it does scroll the UVs, but the TextureID that's being used is still a single one per segment.

To do what you want the ribbon renderer would need to somehow have each particle be aware of the TextureID setup by every other particle to know what to display when the scrolling U field brings that sub-rect to their segment (not sure if that's clear)

And you can't do that with the ribbon renderer :/

I don't see a cheap, obvious alternative, only a very expensive one (have as many ribbon renderers in your particle as you have sub-rects, draw them with the same properties except TextureID and Color, and make each segment transparent except where the sub-rect is, so to display 10 atlases, you'd have 10 renderers. pretty horrible)

Perhaps the effect you're trying to achieve can be done another way than picking random sub-rects per segment and scrolling the UVs ? What kind of effect do you want to do ?
by Julien (35.3k points)
In this specific example, I was trying to do a smoke effect scrolling down a ribbon. Since whatever smoke texture I was using had visible tiling, I thought I'd create an atlas where each frame can blend with each other frame. That way I randomly select a smoke tile each time, and voilĂ ! Randomized smoke!

Mostly it's an exercise in seeing what I can accomplish without a lot of shader control and getting my brain around Popcorn. I'm somewhat relieved that I _AM_ doing it "right", it's just an unsupported function!

All the same, thanks for the quick response! This is totally something that can be handled through shader trickery; I was just trying to be clever. =)

ah, right. Yeah in that case a shader is probably a better solution anyway :)