tangrams / refill-style

From Toner to Tangram
https://tangrams.github.io/refill-style
MIT License
34 stars 12 forks source link

Port dots styles to use texture #32

Open bcamper opened 7 years ago

bcamper commented 7 years ago

We can simplify and improve performance of the dots-based styles by making them sample from a dot texture (that can be further modified in the shader as needed).

patriciogonzalezvivo commented 7 years ago

Porting to uniforms https://github.com/tangrams/refill-style/commit/9898573d8d3aebb8d1ec376478b971b84024a057#diff-2ae5458fe5491a29a9703b5a93751300R1131

@bcamper What about PATTERN_SCALE and DOT_SIZE is ok to add uniforms for those?

patriciogonzalezvivo commented 7 years ago

Mmmm... I just notice that all those dots have white [1.,1.,1.] as background... is ok @sensescape if I hard code that and use remaining uniform space for DOT_SIZE and PATTERN_SCALE cc @bcamper

patriciogonzalezvivo commented 7 years ago

Next step making the texture! @bcamper I have two ways to go here:

Seams the first one is slightly more expensive but more reusable. Also I would love to use some blocks for this... are we ok for adding tangram-blocks?? cc @nvkelso @bcamper

bcamper commented 7 years ago

It might be worth trying both approaches to see what the performance/size difference is. Maybe start with a single dot.

But I'd like all the dependencies for refill in the project itself -- it's been difficult for me to deal with all the imports in Tron (though it was a good experiment), and I'm not yet convinced we want to bring that complexity to other house styles, so I'd rather keep it as an embedded style in here for now.

patriciogonzalezvivo commented 7 years ago

👍

bcamper commented 7 years ago

In general, performance is more important for these house styles than flexibility. Since a second dot texture probably won't add much size, I would likely prefer that (let's check the size?).

You can also make a generic version for Blocks, with a single texture, and keep an optimized version in this file.

patriciogonzalezvivo commented 7 years ago

Cool... @sensescape could you confirmam that the DOT_SIZE in the gh_pages version is what you want? Once we switch to textures will be harder to tweak

sensescape commented 7 years ago

@patriciogonzalezvivo ok! reviewing the dot sizes

patriciogonzalezvivo commented 7 years ago

thanks!

patriciogonzalezvivo commented 7 years ago

sooo... I tried with fixed size dot textures... and seams they don't scale right... so I'm taking the other approach: ONE SDF TO RULE THEM ALL!

sensescape commented 7 years ago

sorry about this mess, so many dots! looks like I'm using them all park-dots1 mixes dots — DOT_SIZE: .1 dots-rev mixes pattern-dots tiny-dots mixes dots3 — DOT_SIZE: .125 medium-dots mixes dots-medium —DOT_SIZE: .25

patriciogonzalezvivo commented 7 years ago

@sensescape THANKS! I hope you don't mind I simplify the names in this commit https://github.com/tangrams/refill-style/commit/a1b463a50dbfc0f3ce89c859a5294a30de7baba9 some stiles where only call by just another style

sensescape commented 7 years ago

yes, please @patriciogonzalezvivo the names were confusing me, i was mixing all the dots up, didn't make much sense! thanks!

patriciogonzalezvivo commented 7 years ago

All changes are here https://github.com/tangrams/refill-style/pull/33 ready for review and merge : )