# Shade generation, custom frame to function

**URL:** <https://forum.babylonjs.com/t/shade-generation-custom-frame-to-function/32148>\
**Category:** Feature requests\
**Created:** [July 13, 2022, 7:03pm UTC](https://forum.babylonjs.com/t/shade-generation-custom-frame-to-function/32148 "2022-07-13T19:03:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johan\_Rabie](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johan_rabie/32/24242_2.png) [@Johan\_Rabie](https://forum.babylonjs.com/u/Johan_Rabie)\
**Post date:** [July 13, 2022, 7:03pm UTC](https://forum.babylonjs.com/t/shade-generation-custom-frame-to-function/32148/1 "2022-07-13T19:03:14Z")

</div>

I have been playing with custom frames, specially in a way to functionally break my code up into reusable parts. Bludy brilliant feature so by the way.

Here is a example

> **[Babylon.js Node Material Editor](https://nodematerial-editor.babylonjs.com/#EK342L%231)**
>
> Babylon.js Node material editor - shader-based materials editor for Babylon.js

In this example I have three circles, each being a custom frame.  
Would it not make sense to treat custom frames as functions when generating the shader?  
This would clean up the generated code rather nicely.

Or, is there a performance hit with functions?  
I saw that in one of the shader videos the presenter was talking about if statements having some performance issues and so using step as a if statement would perform better.

Is functions also problematic or can one treat custom frames like functions?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [July 13, 2022, 8:09pm UTC](https://forum.babylonjs.com/t/shade-generation-custom-frame-to-function/32148/2 "2022-07-13T20:09:39Z")

</div>

Nope functions are fine. We are not trying to have a clear output to be honest. the shader is not meant to be read (not the primary goal of NME )

But I totally get your point still 🙂
