Flutter canvas. How to draw frustum or add a frustum to a basic graphic? - flutter

I know how to draw a basic graphics,
canvas.drawCircle();
canvas.drawPolygon();
...
Is there any way to draw a frustum make it to 3d? Like those:

The 3D effect in the shapes that you posted most likely get their effect from shaders, not from a frustum. There are some limited abilities to use some shaders in Flutter, you can read more about it here: https://wolfenrain.medium.com/flutter-shaders-an-initial-look-d9eb98d3fd7a

Related

Use the sprite normal map to assimilate 3d mesh to use with Unity shaders

sorry if this is a noob question, is there a way to combine Unity shaders made using the Shader Graph with sprites? I would like to use the normal map attached to the texture to assimilate a 3d mesh, so that I can use some more advanced Shader Graph nodes (e.g. Fresnel).
It seems that the 2d shader examples online work only on the dissolve effect, character outline, tint changes, ... and I cannot find anything on using the highlights/lowlights already present in the 2d art to make it behave like 3d. I also have not found any examples of more complex shader effects that work on 2d. Any input would be greatly appreciated.
To give a more specific example, could this shader be adjusted to apply to a sprite?
https://www.youtube.com/watch?v=Cl4wkGjtGgw&list=PLkADxCB_xHGkE3iguVxNOStONQoidH4sr&index=3&t=3s&ab_channel=PabloMakes

How to resize shader area?

I made 2d outline shader but The outline does not render beyond the boundary of the sprite.
so I need to resize shader area.
Is there a simple way to solve it, other than remaking sprites and changing positions in the vertex shader?
In principle you can only draw within the geometry of your object.
In theory, you could tweak the geometry in the shader to expand the border but I have no idea how to do it reliably.
Almost all of the edge shaders I'm aware of use a full-screen post-processing pass to render outlines

Draw free 2d shapes dynamically in unity

I want to be able to draw any 2d shape dynamically in 2d world. My games has moving elements, looking like circle when alone, that can fuse and make complex shapes when getting close together. The elements can still move and thus separate or modify the shape.
How can I draw that with Unity? I don't think the usual sprites can do the trick.
I believe you can do that with shaders (sounds complex to me, but utilises GPU).
Or...
Modify sprite's vertices to introduce streching of the texture.

Custom skybox shader for tiled skybox

I am new to writing shaders. I want to use a texture for 6-sided skybox in unity and I want that texture to be repeated several times also called tiling.
But the default 6-sided skybox shader in unity doesn't have tiling option. Can anyone write a custom shader for 6-sided skybox in unity which has option to tile textures? I also want an option to apply a color tint on the texture if possible. Thanks in advance.
Tiling can be achieved by multiplying texcoord by the number of tiles you want. Or in Surface shader it's uv_YourTex (likely MainTex) instead of texcoord. Writing from a phone so can't post an example, but it's really just one multiplication.
I don't know your specific scenario, but I needed to get more detailed sky with not very detailed texture and instead of UV I used view direction to sample a texture. It made it look like clouds in the distance are further away + clouds can move as you move . It's in this asset.
View direction sampling will not help if you are trying to make space though, which seams to be the case.
Also IMHO tiling on the skybox might be too visible.

"Beveled" Shapes with cocos2d

I would like to draw 2d shapes like this in an iPhone app:
alt text http://www.shaggyfrog.com/junk/beveled-circle.jpg
I asked a similar question here to see if I could do it easily with Quartz, but didn't get a solution. So I got to thinking that I might be able to leverage an exsiting 2d library out there, and then I thought of cocos2d.
The goal is to draw these kinds of beveled shapes dynamically, i.e., using arbitrary colours, and possibly with the highlight/bevel drawn at an arbitrary position.
Is this possible with cocos2d?
As far as my knowledge of cocos2d goes, cocos2d will not enable you to do this in any other way than OpenGL would allow you to do. Cocos2d uses OpenGL under the hood. Cocos2d comes with no built-in set for creating such graphics.
Since the bevel is used to create a 3D effect, perhaps you shouldn't be looking at simulating it with 2D drawing, but instead use a 3D drawing library? OpenGL would certainly be capable of drawing such shapes. Cocos2d focuses on 2D drawing instead of 3D.
I'm not sure if Cocos2D would allow for a custom object to draw 3D using the underlying OpenGL mechanism. I have never tried.
Wouldn't it instead be easier to create the image in photoshop and adjust colors dynamicly? I'm not sure what you are trying to do.
You could also create a mask shape with a transparent "bevel effect" and scale that along with the image you need to have shine?
Aside from the bevel effect, if you want to "colorize" each semi-circle, you can use [sprite setColor:] or sprite.color = ccc3(r,g,b)
CCSprite *sprite = [CCSprite spriteWithSpriteSheet:sheet rect:CGRectMake(32 * idx,0,128,32)];
[sprite setColor:ccc3(CCRANDOM_0_1()*255,CCRANDOM_0_1()*255,CCRANDOM_0_1()*255)];
You would design a "white semicircle" with beveled (gray) edges. Then you can make sprites and color each separately.