Jump to content

Efficient way to create many textured ropes of different lengths?


westy
 Share

Recommended Posts

I have a horizontally tiling texture that I want to use to create flexible ropes in PIXI. I followed the same general path as is mentioned here, and it works, however I do have a slight worry. Every different length of rope in this case means another texture in image memory with size proportional to the rope length. I want to have a large number of ropes, all of different lengths. This feels quite expensive to me - is there a more efficient way to do this that doesn't involve baking a new texture for every rope length?

EexJOsd.png

Link to comment
Share on other sites

set texture wrapMode to repeat (required pow2 texture), and patch `PIXI.mesh.Rope` that way it produces different range of UV's, not 0-1 but 0-N where N is how many times texture was repeated.

If you want the code, you have to wait someone who have free time to make an actual demo. I recommend to implement it based on my suggestion and not wait anyone, its not that difficult

 

 

Link to comment
Share on other sites

You dont have to fork pixi, just extend PIXI.mesh.Rope and override whatever method sets UV's . Its supposed to be changed because there are many ways of improvement for rope and generated meshes in general, I even have special meshes in plugin https://github.com/gameofbombs/pixi-heaven . Its not possible to handle everything in vanilla pixi, our open-source library is supposed to be small.

Link to comment
Share on other sites

  • 1 year later...

Based on ideas in this topic I've been working on my project and  created two demos for PIXI v5.0.0-rc2:

(will not be much different in v4)

1. framing texture + downsample, not easy to work with coordinates, no actual tiling: https://jsfiddle.net/scythian/sta0e87u/

2. extending mesh class + downsample, won't work without power of two texture: https://jsfiddle.net/scythian/rkx0vzuf/

The question is, could the second demo be made a part of the SimpleRope as it adds about ten lines to it? If not, where should I publish a custom mesh for v5? There are no extras anymore.

 

Link to comment
Share on other sites

Anyway, you can use our codebase to make your custom meshes better.

Its possible to integrate some or all advanced mesh features in pixiJS, but it requires time, at least a month or two of active review between us (@finscn, you , I) and rest of PixiJS core team.

Of course if you found simple way to do that (small PR) it would be easier to review.

Look at the bright side! Now we have a demo!!!!!!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...