text:
Ambient Occlusion Error In Knitted Hair System
I'm modeling my son's first plush and I followed this series of videos to do so. I've even asked Bradley on his discord about this and he didn't know a fix for it.
I'm including the blend file below for reference to my nodes setup as it uses Bradley's custom nodes so it wouldn't make much sense even if I could get a good screenshot of the full nodes, which I can't on my 1080p display.
So, the way the knitting works is it uses a single knitting curve object, called the Knitting Unit, and a Geo Node setup drives the distribution across an object in a hair system. The Geo Nodes use a UV Map to distribute a texture on each individual knitting unit so that they are one color per knit, as it should be. It appeared in order to add some extra detail and the Ambient Occlusion that I'd have to use Object Coordinates, but there's something strange going on with the AO. It's creating an unnatural darkness in parts of my knitting objects and I've tried cleaning up the reference meshes for them, because there were faces cutting through other faces. But that didn't fix it, and playing with the node settings and such didn't help either.

I'm trying to go for as close to photo-realistic as I can get, and to have AO is a must for that. So I'm hoping there's a solution here and it isn't just an unsolvable bug.
Thank you all again for your continued support.
Blend file
Link to my blend file

I'm no expert on geonodes or texture nodes, however that tutorial is using Blender 3.0. Be aware that some of the geonodes have changed between Blender version 3.0 and 4.0 (which is what you seem to be using) and for the shading the Principled BSDF node has changed too so it's possible that some of the changes are affecting the results you're seeing. I'll leave others here with more experience to comment further.

@JohnEason Yes, that is an older version, but the full series extends into later versions. What I lifted from that particular video is how to make the Knitting Unit, but I followed a later video for the rest of my setup, and Bradley helped me work out most of the problems I ran into.

I don't know the tutorial, but looking at it quickly, it's using GN, and there are no GN in your file.  I can say, your material doesn't make sense, because it's using something as a normal, that is not a normal, and this is causing your black spots: basically, the normal input you're sending to your AO doesn't make any sense.  If somebody told you to do that, for the mesh you're showing in the file, they're wrong.

@Nathan Oh, so do you mean I don't want anything plugged into my AO Node's Normal? I made that call myself, it wasn't in the tutorial. The AO doesn't seem to be doing anything without the coordinates plugged into it, though? I'm not sure how to fix the GN not being in the blend. I see that my GN objects are hidden in viewport in my file, if you look in the Knit Objects folder, they're in there, if you didn't look there already.

There's probably a problem with versioning.  Your objects in Knit aren't outputting anything in 4.0.2.  Your ambient occlusion isn't doing anything (on my computer) because your object isn't being occluded by anything.  Giving it a nonsense normal makes it do something, but what it does is nonsense.

@Nathan Oh okay, really all I wanted was for it to self-occlude the knitting curves on the object. I guess I can't get help with that if the GN systems aren't packed into the blend file, though. I'm using 4.0.2 as well.

There are GN objects in there, but they're not outputting any geometry.  Your GN node groups appear to not be packed into the file, but linked from some other source that's not included.

Let us continue this discussion in chat.


text:
In Geo-nodes, How could I compare the position of points to each other on a single axis?
I feel this should be fairly straightforward, but I am struggling a bit.
Basically, I want to find out if a point has a point after it on a single axis.
For example, if four points are in a line on the X axis, Each point should return "True" except the final point.
I feel Geometry Proximity would work, but I cannot figure out how to use it to compare a point with the index of 1 to a point of an index of 2 procedurally. (working with a few thousand points).
Here is an example using code if that helps me make any more sense. Here I have a threshold value of 5, so basically if the position of the next point was more than 5 units away, it would return as false.

int currentPtNum = @ptnum
int neighborPtNum = currentPtNum + 1

if (point(0, "P", neighborPtNum).x - point(0, "P", currentPtNum).x <= 5.0) {
    @value = 1
}

else {
    @value = 0
}

My idea was to take the position of point 2 and subtract point 1 from it. But I cannot seem to be able to do that. Hopefully you fine folk may know of a way.

What about using an Attribute Statistics node to get the largest value of X (for example), then a Capture Attribute node to tag points with a boolean based on the difference between point X and X_max if it is below a threshold  ?

Hello and welcome Scouty, you may be inspired by this tutorial: https://www.youtube.com/watch?v=tj6ZZYO5qPY

The Dot-Product of two vectors a and b is the signed length of the projection of a onto b, (times the length of b,) so for positions with a common origin, can be used as a comparative measure of 'how far along' the axis b the point a lies:

.. above, compared with the maximum such value. The 'Vector' input is any vector in the direction along which you want the comparison to be made. All points other than the maximum in that direction will evaluate True.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Adding a simulation zone mess up previous nodes
I'm trying to animate the opening of a book (especially the pages), and the pages turning. For some reason, I can't add a simulation zone without messing up my current node tree. As if it was cancelling some nodes before it (like Set Position). That's my current problem, but my setup being a bit complex, I have to explain it as below.
The blend file :
First here is the book, before and after opening :

My geometry nodes are a bit on the heavy side, here are the nodes followed by informations :

To explain all that, here is an annoted version of my setup with the main steps :

Generate a vertical array of horizontal curves (i.e. the profile of each page)
Move left-most handles to follow the book opening (using a rotating empty)
Trim the curves to keep a given length (here 21cm)
Then I want to add on top of that, the animation of pages turning. That would the step 4 which I want to place between 2 and 3 (blue arrow). I'm pretty sure I need to use a simulation zone (indepent animation of each page, animation that must changed along time).

And then, with only the addition of a simulation zone, the step 2 is completely ignored. But not the step 1.

I've got to say, I have no idea why. I'm used to Blender but I think I'm missing something.

Why is the simulation zone cancelling some nodes but not all ? Am I missing some obvious thing ?
Is my way of doing things wrong ?
Should I put everything inside a Simulation Zone ?

Thanks a lot for reading me :)

Could you provide your Blender file using https://blend-exchange.com/ ?

I edited my post with the blend file.

As I understand it, every nodes that are upstream the Simulation Input node and linked to its Geometry socket are executed once (at iteration 0 ?). Then the geometry is recycled inside the Simulation Zone. Every nodes that are downstream the Simulation Output node are executed after each iteration. So to get the curves deformed by the Empty, you have to bypass the Geometry socket of the Simulation Input node. Instead, plug it directly "inside" the Simulation Zone. To start with, plug it directly to the "inside" Geometry socket of the Output and you recover the animation.

Merci bien ! I get your point, I will try that. Thanks :)

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Getting 0 Volume for object
I am trying to calculate the volume of a 3D scanned object using the 3D Print add on.
The object was captured with a structure sensor/ipad and then imported to Blender (version 2.79). The scanned model is of a small box (~8x3x6cm), so simple at this stage. As the object didn't have a base when imported, I followed instructions from this web site to add a base using re-mesh and then smoothed.
I activated the 3D Print add on and changed to metric units with cm selected. I then asked the program to calculate the Volume of the object in the 3D Printing tab. The volume comes up as 0.0 cm³.
There are dimensions in the right hand side panel under "Transform" of 81.38x23.00x59.80 um. Again this isn't quite right as the dimensions should be about 80'000x30'000x60'000 um given my physically measured box.
Any help in getting the volume calculation function to work would be appreciated.

I fail to replicate the issue. 3d Print Toolbox addon seems to deal well with all kinds of wrong geometry. It even works with a sphere cut in half into 2 separate pieces of geometry. Could you share some screenshots of your mesh or the .blend file?

Thanks Martin. I would be happy to share some screen shots or files, but I am not sure how to do so on this format?  I also don’t have any online storage to direct you to.

@ann, you can add image to your question by doing "edit" and using the relevant toolbar icon in the edit area. To attach blender files, visit https://blend-exchange.giantcowfilms.com/ first: that website will create a link to your file that you can then paste in the edited question (only blend files though)

μm is Micrometre, one thousandth of a millimetre (0.001 mm or about 0.000039 inch).
If you try to calculate the volume of 81.38x23.00x59.80 um it will be around 0,0001mm3 or 0,0000001cm3 that is to small and rounded.

If you want to measure object in imperial units you need to go to scene tab and select this unit system from presets:

Thanks for your advice Crantisz, always appreciated! I had selected cm from the Scene --> Unites menu :) I think the issue is scale as Nicola suggests below.

Select your object, scale it 1000x up (S, type 1000, enter), hit . to bring it back into the view, then Apply Scale (CtrlA > Scale).
Your object seems to be just a few micrometers large. If you have previously applied a scale measure using some reference stick in your 3D scan, probably something funny happened while importing the object to Blender: it would be a strange coincidence that your dimensions are almost exactly 1000 times off.

Thanks for your advice Nicola :) I do think the issue is scale. I have now scanned 3 different box's and each time they have come in at 1000x too small
However volume may still be a bit of an issue as when I scale up and re-do the Volumes they come in less than what I would expect. For example, for the box above the physical object is 8x3x6cm = 144cm3, Blender gives dimensions of 8.14x2.30x5.98 = 111.96cm3, however blenders calculated Volume is 96.43cm3. This is nearly 50cm3 less than the manually calculated volume, quite significant when you are only taking a 150cm3 volume to start with

Another box, 23x11.3x16 = 4158.4cm3. Blender image 23.98x12.71x17.54 = 5345.94cm3. Blender Volume 3841.02 cm3. Large difference for a fairly square object. There are some variations in surface texture, and some internal structure before holes are filled in with re-mesh. Is this enough to make such a large difference? Ultimately I want to scan coral colonies (~15cm round) and get Blender to give Volumes. Online info indicates, scanned image should contain size info that Blender can read and extrapolate. I haven’t applied any scale measure, just imported the .obj file and asked for the Volume

My concern is that if I import a coral file, I won’t know what scale to use. It is looking pretty consistent though as I also checked a coral model that I loaded into blender and that also seemed to be 1000 off. Another concern is the Volume measure. Is there any way to make this more accurate that you know of?
Thanks again for the advice :)

dear @ann, unfortunately I don't know much about the volume tool: the 3d printing add on is not one I use. I can only help you understand the mismatch between 8.14x2.30x5.98 = 112 Vs 96: the former is the size of the bounding box (that can be stretched out by any little bump in the model), the latter is the volume of the object, where morphology is taken into account. as for the mismatch between expected and obtained result, I'm not familiar enough with your process to identify the cause of concern, sorry

Hey Nicola, Thanks a lot for the response :) Your help has been very useful and appreciated! I will scan a few coral and see how it goes.


text:
Environment Map renders wrong

When I'm on Solid view, I can see the environment map. However when I render I get this glitch with my image. I'm in Perspective view, I removed transparency, the image is showing until I render. Why? I adjusted my clipping at 100ft, so I know its not that. Any Help would be appreciated.

I dont understand your question, are you trying to have a transparent background but still use the lighting from the HDRI? if So just go to render tab > Film > uncheck transparency. Can you clarify what the problem is?

Thanks for the quick response! I'm trying to have my environment map show up in my render but its rendering a glitched image.

if you can upload your blend file I can take a look its to hard to tell by just that screen shot.

Are you referring to the small piece of sky showing through the gap in the roof? It’s really hard to tell what’s going on from that. Perhaps try and isolate the problem by removing everything that isn’t relevant, leaving just the environment map. Perhaps that will then give some clues as to how it’s distorted. You could also provide your HDR image as it could be a problem with that.


text:
Light not passing through all windows
I am creating a room using archimesh. And have applied auto holes
I have a room with three windows, all set up the same, all using the same material. If I place all the windows in the correct position light only shines through one of them.
If I remove the windows from the building and then only place one in position at a time then 2 out of the three allow light to pass through.
I cant seem to find out what is going on?
Any ideas
Thanks so much


text:
Problem with lighting
I have a problem with the lamps. When I first create them, it all goes fine. But at some point of making them, or when I deselect them and work in other stuff, they get lost in the viewport. Only their light is visible in the material mode, and they still appear listed in the outliner, but I can't select them.
If I try to create new ones, they don't cast any light.
What can I do? Is there any way to reset the lights or something?
Thank you so much!
P.S. I'm using the Blender Render engine.
EDIT: I was asked to post some screenshots, so I tried to put lamps on my project again.

This time, the lights didn't work from the very beginning. I haven't changed anything in the project since the last time I tried, so this behavior in Blender seems completely senseless to me, like a bug.

Here, I turned off Environment Lighting.

These are the material settings for the mesh I'm trying to put the lights in.

Could you post the a .blend file or some screenshots?

@Ben yeah, done!

For those with the same problem, I already found the solution: I was in the local view, and I got out pressing "/". Idek when did I enable it, lol


text:
Blender 2.83 limit track

Video (Google drive)
I couldn't upload a video on the website so I uploaded a video to Google drive. Anyway, I've created a drawer and gave it a 'Limit Distance' constraint. It works well in the front direction, but when I try to pull it back, it goes to the back.
How can I fix this? I want to do this one way (in the front direction). This should not go backwards.
I'm sorry for my bad English. Thanks in advance.

Hello, what's your question ?

oh sorry, how can i fix this. I want to do this one way(in front way) this should not go backwards.

Limit Distance as the name says limits the distance to a target. Which means, you can move the object in any arbitrary direction (spehrical around it), as long as it's stays within the set distance.

oh all right i got it thank you

I think what you want is limit location, not limit distance.

Just set min and max of 2 axis to 0. So you cannot move it on that axis.
And set min and max value of your "moveable" axis to 2 values (min should be lower than max).
then you get:

YES, thats what I'm looking for. I'm appreciate for your reply and your time.

You are welcome.

@Burak Other than shown in the screenshot you should rather set Owner to Local Space instead of World Space. If your drawer is parented to the cupboard and your moving the cupboard around, the drawer will stay in its place (or move only those 2 m in Y direction) because the location is limited to World Space.


text:
Why texts/bevelled curves not showing up just untill converting to mesh in Eevee?
Why are texts/bevelled curves not showing up until converted to mesh in Eevee? I have this happen only on my new PC.
Also to be able to work in Eevee I have to enable High Quality Normals, which is weird for me, and I feel that it may not be the proper way.

Hi, please [edit] your question and add images that show your issue. Thanks

An external link is not what is expected here. Please add images directly in your question. Thanks

Is it a AMD gpu?

yes, and the cpu as well


text:
How to do 3d programming with Blender using python
I am planning to learn 3d programming with Blender using python programming language.
Like i want to program some object etc. in python and when i run the script, all the created objects etc. should show in blender.
Is it possible? If yes anyone please let me know how can i achieve this.
I would only like to know about, How i can connect Blender to the code running on my terminal via a python script.
Thanks

Hello, just as a head's up this question is really too broad and opinion-based to be accepted on this site. You should start by following the official documentation and tutorials online, and if you have trouble achieving specific goals, you can always come back here and search if someone else already experienced the same problem. If not, feel free to ask a question about it in the most precise way possible. cheers

@Gorgious Thanks for the reply i would only like to know about, How i can connect Blender to the code running on my terminal via a python script.

I'm not sure if this answers your question, but you can write an add-on for Blender in Python, write a script and execute it in Blender's Script Editor or start Blender from the command line / terminal with the --python flag and pass the path to the script. In every case you will want to learn how Blender's Python API works, which is documented in the API docs.


text:
Does Clipping Work in Blender 2.9?
From the Blender docs, it appears that when I create a view > render regions > clipping region (CMD + B), only the selection within the clipping should be visible, however:

I have tried different views. Also checked to see if, for example, Transform, would only with within the "clip", and that doesn't happen either. Rendering also isn't limited to what's inside the clipping area.
So am expecting I am missing a step or otherwise misunderstanding either:

what is supposed to happen
how it's supposed to work
how to achieve it

Thanks.

From  your screen shot, you enabled "render region" rather than clipping region. Not sure what's the correct key bind in Mac OS, but in windows, it's Ctrl + B (Which might be eq to Cmd + B in common translation).
Please look at the menu again, it said Alt + B to create clipping region, as the following picture show. Red dashed line is for render region, and it's separated from clipping region.

Remember, It is "clipped", not hidden. It should only be working in Solid or Wired Frame view mode. On the other hand, render region only works during rendering in Cycles.

Isn't the stuff outside of the clipping region supposed to be hidden, though?

Hey, it's working now, as I had expected, in a fresh file. Does it only work in certain views?

It is 'Clipped', not hidden. It should only working in "bench mark" view mode (solid, wired frame). On the other hand, render region only work in 'render' (Cycles)

Thanks. I edited your answer, adding that last comment.


text:
Normal Maps create very high lighting contrast under sunlight
I am new to Blender and I am currently working to understand materials. I am now trying to apply normal maps to add details which, correct me if I'm wrong, create a really nice and realistic "scattered" highlight effect. However, with HDRI lighting implemented and under certain camera angle, the light and shadow contrast is somehow exaggerated creating a very hard and defined  shadow line. I changed to the displacement modifier and the shadow seems more or less reasonable, but I am on a rather low-end PC and it can only afford a 10 subdiv, so I cannot be certain about that. Please could anyone tell me if this is how things are supposed to be, physically speaking? Thanks for any help.
This is what happens with normal maps applied
This is the render result with the original principled shader

This is the result from the displacement

And this is my node setup, as you can see, it is really just a normal map, and I have already set the color space to non-color. The hdri I use is the "urban street 04" from hdri haven and the texture is "Fabric 039" from cc0 textures, both in 2k resolution. Links below:
https://polyhaven.com/a/urban_street_04
https://ambientcg.com/view?id=Fabric039

https://blender.stackexchange.com/a/234846/110840

Displacement is a different thing, I wouldn't place your normal map there.

Oh by the word "change to displacement" I mean apply a displacement modifier with a displacement map, changing the geometry, that kind of thing. Sorry for my bad expression xD


text:
Can't set major radius of a torus to anything larger than 1 meter
I am modelling in Metric mode. I added a torus in Edit mode and it will not allow me set set the Major radius to anything larger than 1 meter. If I type in a value greater than 1m, it just changes back to 1m and clicking the arrows on the size control will not increase it past 1m.
This is probably stupid, but is there some setting that I might have activated to prevent larger sizes? I've double checked that snapping is off, so I'm stumped.
What could I be doing wrong?
Additional info: I have the scale of the metric units set to 0.01 and this seems to be the cause, but why?
Steps to Reproduce:

Create new project
Delete default cube
Set scene to Metric units with scale of 0.01
Add a torus

At this point the Major radius of the torus cannot be made larger than 1 meter.
More information:
If I change to metric units but do not set the scale, then the major radius of the torus is capped at 100m.
If I do not change to metric unit but instead stay with Blender units, then the major radius is capped a 100bu.
This seems to be an arbitrary limit.  Is there any reason for this limit?

I don't have any evidence to bring up, nor I talked to the developers, so just take what I'm saying as my personal opinion build upon usage experience.
Many sliders in Blender have values capped to certain values. Their purpose is to avoid crash in the software caused, for example, by intense computations. A famus example is the 6 step for the Subdivision Surface modifier. Without having that, the casual user can easily click and drag the value and he'll probably get a freezing window that may ruin hour of work.
"Stop steps" can be said be an help to prevent behaviur that users tipically don't want: they are a threshold that is warning you: "before crossing this line, think about twice what you are doing...is that what you really want? are you conscious of the consequences of your actions?".
So why capping the size of an object to 100 units can be helpful?
I would say that all is related to the default scene. While everyone love to delete the default cube, not as many tend to erase the Camera, or if they do, the Add Cam command place one that has one thing in common with the default: the clipping limits.
The End Clipping is always set to 100 units, so making objects bigger than that would not ensure that they will be contained in the frustrum, and so visible from the cam. In this sense, placing a "Stop Step" is an help to avoid adding geometry that can't be seen unless you are really sure is that what you want to do.
The "100 Stop Step" infact exist in all the default primitives (Plane, Circle, UV Sphere, Ico SPhere, Cone, Torus, Suzanne...) but only in the Torus object can't be surpassed. My wild guess would be that it's  the code  has not been update yet (in Blender 2.45 every primitive had the limit).

I suspect you are correct.  I went into the  \blender\2.77\scripts\startup\bl_operators\add_mes h_torus.py file and changed the max value for the property to something other than 100 and it worked just fine.

from blender's point of view, units are the same : 1 BU = 1 m = 1 foot = 1 basic unit. There is no conversion if you change unit type. 1=1
But you can change the scale of the scene if you're in metric or imperial. This allows objects to be the size you want, but won't change the objects themselves.

So if you want to create a planet size scene, you'll use a big scale to create big objects.
If you want to create standard objects (a car, a man, ...) you'll use standard scale.
If you want to create very small scene (insects, bacterias, atoms, ...) you'll use a smaller scale.
This only allows objects to have the corresponding dimension but has no meaning in Blender Units because BU has no reality, it's just considering the relative size of your objects.

I understand this.  I tend to model exclusively in Blender units, but I am creating a mesh to export via .fbx and import into a game.  I have to set the scale to 0.01 otherwise the game does not import it properly.  But this doesn't answer my question.  My question is why is the torus major radius limited?

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Lattice for vertices?
I recently watched a gun modelling tutorial in 3ds max and the instructor often used a tool called "FFD modifier".
The way he used it was by selecting a few vertices/edges, click the ffd modifier and then he could transform only those vertices

Is there something similar in Blender?

Or you could hook verts with Hook modifier

You can use a normal lattice deform modifier but specify a vertex group that has only those faces.

Select the faces and add them to a vertex group:

select both objects with the lattice active and press ctrl + P ,Lattice deform.

select the object and select the vertex group in the modifier.

Now you can only edit those faces.

Indeed you can use ALL deforming modifiers selectively with vertex group. And for quicker effects you can use proportional edit with appropriate curve and radius in edit mode.
When you make a vertex group, remember to press "Assign" as well, you can easily miss it assuming its enough to create a vertex group with a selection.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Disable the 'see though mode' in edit mode
I am currently modeling an ear and it becomes very hard to see some vertices

I know that I could hide some geometry in the background, but is it possible to completely disable the see though mode so that I only see the vertices on the surface?

Enable limit selection to visible in the bottom tool bar.


text:
How can I set the focal length independent for x and y?
Is this even possible? Or does blender only support one focal length for x and y? And is it possible to set the focal length in pixels instead of mm? Because to set it in mm I would need to know the width of the image sensor, which I don't have. I am trying to model a real camera which I calibrated and the calibration software gives me fx, fy and the principal point I could set the principal point, but I'm still stuck with the focal length.

I believe this is NOT possible but Im still interested about the reason You need this.

I think you are confusing something. Please see https://en.wikipedia.org/wiki/Focal_length  One camera lens can only have one focal length at a time. It cannot be different in different axis - this does not make sense. It is measured in millimeters. Setting it in pixels would not make any sense as well since pixels do not represent any actual distance in the scene.

I thought so too, but you can check here: http://ksimek.github.io/2013/08/13/intrinsic/ under focal length it explains why it makes sense to have these seperate. Setting it in pixels is very common, because a lot of calibration software for calibrating real cameras gives you the focal length for x and y in pixels and I would like to model a real camera.

Btw does it make sense to specify the focal lenght in mm and the fov? it doesn't right it's either or?

Related: https://blender.stackexchange.com/q/55473/599

A Blender camera does have a different focal length (or expressed as an angle, field of view / FOV) in the X and Y, however, this just follows directly from the ratio between the image plane width and height. The focal length (or FOV) that you set in Blender refers to the horizontal/width of the image plane. For example, if you use the default image plane dimensions in Blender (1920px x 1080px; you can change this in Scene Properties > Format) and you set the camera FOV to 90 deg, the FOV will be 90 deg in the width/horizontal dimension of the image plane and 60 deg in the height/vertical dimension. I'm giving this example in terms of FOV rather than focal length (in mm) because it's more intuitive that way; but they are equivalent.
If you are setting up a camera in Blender using an intrinsic camera matrix, it's easier to use FOV angles since you can get these more easily from the matrix (see https://stackoverflow.com/questions/39992968/how-to-calculate-field-of-view-of-the-camera-from-camera-intrinsic-matrix). Set the camera image plane dimensions in Scene Properties to match the dimensions of your image plane and then set the FOV of the camera (in degrees) to match the FOV in the X-axis from the intrinsic matrix (the one derived from fx). The FOV in the Y-axis will automatically correspond to the FOV derived from fy based on the image plane ratio.
I think if your camera calibration includes distortion correction it's possible that the ratio of the FOV angles from the intrinsic matrix won't correspond exactly to the ratios of your original image plane, but it will be close (e.g., 1.6 vs 1.5). I think this would be because the distortion correction could alter slightly the dimensions of the image plane.


text:
Why does my rendered object appear too big compared to object taken with real camera?
When I try to render a cube it appears too big compared to an image taken with a real camera and to the opencv method projectPoints.
My setup
I have a box and film it with a camera. A motion tracking system gives me both the position of the camera and the box. Now I can use the positional information, the size and the intrinsic camera parameters K to project the corners into the image. In blender I set the box size and pose. I also set the camera pose and K which is and my image resolution is 640x480:
$$
    \left(\begin{matrix}
    610.55992534 & 0 & 306.86169342 \\
    0 & 610.32086262 & 240.94547232 \\
    0 & 0 & 1 \\
    \end{matrix}\right)
$$
and I set it like this:
cam.shift_x = (306.86169342 - 640 / 2) / 640
cam.shift_y = (240.94547232 - 480 / 2) / 640
cam.sensor_width = 3.896
cam.lens = 610.55992534 / 640 * cam.sensor_width

The blue points are the points received with the opencv method projectPoints which takes the points to project, pose, K and projects the points into the image plane. The grey box is the one rendered with blender.
Since the blue points are pretty much correct(the residual error is probably calibration error) I think my measured poses of the box and camera and K are right. My K is:
I entered the values for the first image into blender to visually confirm that the setup looks right and it does:

But the picture rendered with the GUI looks exactly the same like the one rendered by my code.
Where could the error be that my cube is rendered too big? Did I forget to set some important camera parameter? What more could there be than setting K, and box_pose and camera_pose?

I just realized my error. I was setting the scale of my cube instead of the dimensions and since the default dimension is 2m^3 the cube was double the size it should have been.


text:
How to render objects with the same color for all sides of the object?
I am trying to create a label mask for these objects:

I am rendering models of the objects in Blender, but the problem is the lighting. I tried using a point lamp or a hemi lamp, but both give shadows, so that the cubes actually look 3D, which makes sense. I tried deleting the light source but then my cubes are just all black, which also makes sense, but is not what I need.

How can I render my cubes to have only one color for every side?
EDIT:
@martins answer solves my problem with the different colors, but now the edges are blurry. How could I fix that?

have you tried with an Emission node instead of a Diffuse?

I'm totally new to blender and don't know what that is, I can try it but do you mean to apply it to a light source or the the cube materials?

Awesome this nearly solves my problem, now I only need to make the pixels between the cubes only one or the other color. But I'm not sure how to phrase this question

Anti-aliasing is a good thing for masks. Actually I would recommend rendering only red green and blue (RGB(1,0,0), RGB(0,1,0) and RGB(0,0,1)) colors so you can use RGB channels as anti-aliased masks.

It might be a good thing for masks, but I'm not sure the neural network I'm trying to use can handle that. But thank you for the term, now I can try to find out how to turn off antialliasing

You can use emission shaders in Cycles:

or shadless material in Blender Render:

I used the emission property with success, but the edges are still blurred and not sharp like I need them, I will make an edit with a screenshot it's the easiest. Thank you for your edit and answer :)

It's not a property, its a shader. Shaders have properties. Emission shader in Cycles has color property and strength property. Terminology is very important here as words that are synonyms in natural language may mean completely different things in 3d. It pays off to make an effort to use the terminology correctly.


text:
VSE: Why is the first part of my sound cut off?
In track 1 of the Video Sequence Editor, I inserted the same piece of audio several times:

But when I render out the video, the sound byte sounds different on every occurence.
When I extract the audio track from the video and take a look at the waveform in Audacity, it looks like this:

As you can see, in most cases the first part of the sound is cut off by Blender, each time at a different location in the waveform.
Could someone explain to me why this is?
Of course I could fix this issue by starting each audio fragment with a short piece of silence, but that would make it harder to position my sounds at the exact right position in my video.
This is the sound file I'm using: http://www.mediafire.com/file/1nonz7niy3502xw/Bounce.wav/file

Could you provide an example of the audio-file so we can try to replicate your issue?

You can find the sound file here: http://www.mediafire.com/file/1nonz7niy3502xw/Bounce.wav/file

Never checked this but you're quite right. The sound profiles look different. According to a little chat on the vse channel (https://blender.chat/channel/vse), @snu pointed me to the existence of a "Render Audio" only possibility (menu Render > Render Audio). There, you can specify the "Accuracy" level of the audio file (lower numbers give better quality). So, when I rendered your sound file with the level set to accuracy=128, the wave profiles in Audacity became virtual identical. I don't know how to set this accuracy level from within the regular rendering (Ctrl+F12). Hope this helps.

Thanks, I will have a look at it.


text:
How to do camera tracking for a video shot in portrait mode?
Whenever I try to do camera tracking on a video that was shot in portrait mode (1080x1920 pixels), I fail to get a proper result. In the 3D view (with the video footage as a background) the trackers don't end up in the right place:

When I take the exact same video and rotate it 90 degrees before importing it in Blender, I get the correct result:

I am using Blender 2.90.
In both cases I do the tracking using Motion Model = "Location" and Match = "Previous frame".
I keep the default camera settings that Blender uses for a new scene, and solve the camera motion using Refine = "Focal Length, Optical Center, K1, K2)".
Then I set the floor, origin and y axis using the exact same trackers.
Of course I could do camera tracking on portrait scenes by rotating them first, but that would be very inconvenient: looking through the camera with the video background, I would have to work on a scene that was rotated 90 degrees.
My question: is it possible to do camera tracking in Blender using a video in portrait mode? If so, what should I do to make it work?
NOTE: A workaround would be to turn a portrait video into a landscape video by adding black bars to the left and right. I already tested this, and it works. But I would still like to know how to do camera tracking on a portrait video. You'd think this should be possible in an era in which portrait videos are almost more common than landscape videos.
An example of a portrait video for which blender gives an incorrect camera tracking result, can be found here: https://app.mediafire.com/icyvdawxlli8q
There you'll also find the same video in landscape format, that doesn't cause any problems.

try changing location to perspective

That helped to get the solve error (previously 0.85) down to 0.52. Thanks for that! Unfortunately, it didn't fix the problem that the track marks end up in the wrong place in the 3D view. When I do camera tracking on the horizontal version of the video, I get a solve error of 1.38, but a perfect match in the 3D view.

you have more than 10 tags , you can remove some poor tags and try if you could get a sub 1 solve error , and if you are done  , can i write it as an awnsere

As you can see in the picture above, I get a decent match for my markers even with a large solve error 1.38. That is: in the case of horizontal footage. For vertical footage it doesn't matter how low the solve error is: in the 3D view all the tracking markers end up far from where they should be. The question is: why is that?

See idk if there is a legit answere for why is that , but see some things are provided so that the machine can understand your intensions properly and give desired results so actually perspective is for most cases in motion tracking.

Could you open the original file in a video editing program and export it as a landscape file with black bars on the side?

Yes, adding black bars works: the camera tracking result is correct, because the video is in landscape format again. This could be a workable workaround, but I'd still like to know the answer to the original question: how can I do camera tracking on a video in portrait format?

Can you share your video to let us test? It can be the algorithms expects in calculation the landscape ... Have you tried to mark markers as "Wall"? BTW portrait is used my weird people on mobile. Capture for pc / tv portrait is useless.

I uploaded a testfile Portrait.zip here: https://app.mediafire.com/icyvdawxlli8q
I'm currently uploading a Landscape.zip too.
For the landscape version, camera tracking works, for the portrait version, it doesn't.
NOTE: it's a different example from the one above, but the issue is the same.

Portrait

Under Solve tab check Refine > Focal Length, Optical Center, Radial Distortion with those I got nice error only 0,10 px
Set Floor, Wall, Center, XY axis - with that I got camera correctly orientated

The only one thing that didn't match was camera Focal Length (and Shift).

If you select camera and go to Properties editor > Object Data > Camera > Sensor Fit and switch to Horizontal > Width 35 mm.

It does not fix the value itself, but empties and reconstructed scene match perfectly.

I still don't know why the given Focal Length is incorrect, but I'm not a tracking guru :) Alternatively you can adjust Focal Length and Shift manually according generated Empties.

Notes
How to determinate Lens Distortion
How to get better result ...

Thanks, that worked, although I needed different shift-values to make the markers match the video.
If nobody finds a way to make it work without manual tweaking of the camera settings, I will mark this answer as THE solution!

Yes, I created the test scene with a camera with Focal Length 50 and Shift 0.

Edit: Can you try to change Camera Object Sensor Fit to 35 mm?

YES!! That is the simple solution I was looking for (sensor fit = Horizontal, width = 35 mm). Thank you very much! Could you add it to your official answer above so I can mark it as "Accepted"? The funny thing is that yesterday I advised somebody else to use the Sensor Fit setting (https://blender.stackexchange.com/questions/201097/how-to-change-the-render-image-size-without-changing-camera-settings/201103#201103) without realizing it could be the solution for my own problem too. Thanks again!


text:
Parent object to active camera? [Solved]
I've tried several ways to change the density of grass according to the active camera distance without success.
Is there any way to parent an object to the active camera? Or to get the active camera location in geometry nodes?
For a single camera it's easy, but to have it automatically adjusted when switching cameras seems impossible.
Am I missing something?
Edit ANSWER : this can be done through drivers as inputs of the geometry node group.

Does this answer your question? Billboard to scene camera? ...With this solution you would at least be able to determine the position of the active camera.

Indeed! I added 6 drivers (for location and rotation of the active camera) as inputs and was able to achieve the expected result! Thank you!
Still it would be nice to have a 'local camera' geometry node to spare the hassle ;)


text:
How to prevent overlapping when moving meshes?
Is there a way to prevent overlapping when moving meshes?
I'm trying to emulate the assembly of planks in a furniture or cut stones in a wall.
EDIT : It is a GUI manipulation that I'm looking for. A bit like assembling Lego bricks in realtime in Blender (thus there is no animation and there are no frames).
I tried rigid body but it only works with a simulation. It tried the limit distance constraint without success. And "snap to edge/surface" can lead to errors as soon as you work with round/beveled/subdivided shapes.
I'd like the movement to be stopped when the two bodies start intersecting.

How many pieces are there? How do they vary? Are you likely to change some sizes in the future?

Thank you for your comment  !
Around a dozen pieces I'd say. Normally I shouldn't change a lot of their sizes but as it is during the design process of a furniture, there are always adjustments :)

Are you animating this manually? If so why don't you snap to face then set that as your final keyframe? Then go backwards on the timeline and set your start point with the plank above? If the bevel causes you problems with snapping to an edge, then why not choose which part of the bevel you want on the surface, then snap face to a suitable vertice on the bevel? Works for me.

It is actually not an animation but GUI manipulation. A bit like assembling Lego bricks in realtime in Blender. Thus there are no frames.
But thanks for the proposal. I'll edit the post to precise things.

Have you try using python and bounding box on your objects? This way you could manage the intersections. But of course It will require a bit of coding.

@b-pader I am not a specialist in python coding but I do understand coding and I'm not afraid to try. Can you please elaborate how it would work dynamically in the GUI?

Have you tried using rigidbodies?

From what i know, rigid bodies only work when animating. Not in the GUI. How do you imagine to use them?


text:
How to get proper UV mapping with an Ocean modifier?
I want to apply a gradient like texture on an ocean plane. Without the modifier, it works perfectly as shown below.
As soon as the Ocean modifier is applied with repetition on the X and Y axis, the UV Map is neither tiled nor applied to the whole surface.
I tried Object, Generated and UV without success.
How can I fix that?
Without modifier:

With Ocean modifier:

Modifier options:

You could use UV Project modifier after the Ocean modifier to project UVs from another object:

For me with Blender 4.0 beta, Martynas solution didn't work (the UVproject modifier didn't work with the Ocean modifier). But the approach gave me an idea which was useful ^^ Thank you!
Adding an intermediary geometry is indeed the solution. With an additional plane, the UVmap of the plane is chosen as an input for the texture coordinates in the shader of the ocean.
And it works like a charm.

EDIT : Martynas solution DO work in Blender 3.6 at least.

I am glad that you found another acceptable solution, but I don't know what you are talking about regarding UV project modifier not working. It works just fine as well.

Well I must be super unlucky :/ I don't know why it doesn't work :  screenshot here

OK, that's weird. I am using version 3.6.1 Baybe you are using older version? May be a bug.

I'm on 4.0 beta. I just edited my answer to enable your solution

I thought it's pretty much the same with Material nodes and the modifier. Well the node solution is definitely not worse in any way, so at least that works.

Yep, I'm glad I have at least a working solution and 3.6 users, two solutions :)

It is weird though. Seems to work on 4.0 Alpha for me as well. No idea why.

Maybe I'm not using it correctly. No idea either

Just to check, did you use multiple repetitiond on X and Y for the ocean modifier?

Yes, I certainly did. I did open a file set up with 3.6 though, instead of making it all in 4.0, so that maybe why it worked. I will check it better when I get a spare minute just out of curiosity.


text:
Animation Doesn't Have My Texture Paint in Blender
I'm trying to render an animation in blender but my texture paint seems to do nothing. And it's weird because when I go back into Texture Paint everything is still there.
I looked it up and didn't find anything useful, I tried repainting everything, and changing the shading but none of it worked.
Edit: It seems that it renders with the 4th viewport shading option (the shaded circle) and when I turn that on it looks exactly the same. So how do I render it in the 2nd one (the full circle)
Edit 2: It seems that I only used the Base Color Texture for the door (the gray piece in the back) and I need to redo the texture painting all with Base Color for the texture.
My Texture Paint:

My Blender Render:

My Blender File:

Hello could you please share the object itself? Don't forget to pack the images (File > External Data > Pack Resources)

I'm not sure where you've got your information from for working in Blender, but it looks as if you're trying to texture and render your scene in Viewport Shading mode (the full white orb).  That view is supposed to be used for modelling, not for texturing and rendering! Have a read through the section in the Blender manual to show what each mode is used for. You should also research some of the thousands of YT videos which cover materials and texture painting in Blender.

Yes you are probably confusing some modes, in Solid mode by default you'll only see the painting if you are in Texture Paint, otherwise your objects will look grey, so switch to another mode to see the result

I meant to include the link to the relevent section of Blender's manual in my previous comment.

Wow, thanks everyone for the help, I'll be sure to read through that manual, I am pretty new to this stuff


text:
Strange rotations values, i rotate z axis, in side bar all x,y,z values change?
I'm trying to rotate an object in global using the hotkeys rotate-z, I expected it to only affect the Z axis rotation values yet its modifying all rotational values almost as if its using local? Am I doing something wrong?
ive tried applying rotational values, changing origin point but still persists

Hello could you please share your file? https://blend-exchange.com/

i'm sorry I can't. its for work, thats why its just a couple basic pieces thats visable

You could just share the piece itself

Is the object the child of a skew parent?

Ah yes Robin it was! thank you!


text:
Cylinder radial extrusion connected to other faces
How do I make so that this shape on a cylinder can be reapplied to all other faces radially without them connecting?
This should look like a bevel gear.
I suppose I could use Array modifier, but I'm afraid the wider part won't be connected to the initial cylinder.

does it mean that it should look like the one on the left (the one on the right would be one face out of 2): https://zupimages.net/up/23/24/rv78.jpg and what do you mean by not connected? Maybe show a reference image of the object?

https://mechanical-engineering.s3.amazonaws.com/gallery/album_133/gallery_53_133_9465.jpg
Basically something like this.
I feel like most modifiers will just copy the shape and won't connect the copied ones to the wider cylinder part

To do what you show, you can easily do it with a portion of a 32 vertices cylinder, remove 30/32 and give it an Array modifier with its Object Offset option, choose an empty as object and put it at the same location as the cylinder origin:

Then rotate 22.5° on Z the empty:


text:
Even out existing loop cuts
How do I even out existing loop cuts?
I know about the LoopTools "Space" tool, but it requires pretty much manual selection of horizontal edges, "Select similar" doesn't select the ones I need.

Using Select > Select loops > Select Rings on a ⇧ Shift + Alt selected edge selects all similar edges.
LoopTools' Space works just fine on those.
.


text:
How to fill a maple leaf shape properly?
I got this maple leaf shape and I want to deform it later on but I can't figure out how to properly fill it. Using the normal fill makes the triangles in the middle way too long, grid fill doesn't work at all. Filling it and then remeshing it in sculpt mode doesn't work since it just disappears as soon as I use a value under 0.1m which is way too big for it to look good and converting it into a curve and filling it doesn't work either. I didn't find any other method to fill it so I hope you can help me
Here's the Blend file:

https://www.youtube.com/shorts/sv9sa12d0yo

Make a plane this size to cover the leaf outline and subdivide it as much as you need for simulation:

While in edit mode, select leaf in outliner, so that blender is in edit mode of subdivided plane and Leaf object is highlighted with orange color:

Mesh -> Knife Project:

Invert selection Ctrl + I

X -> Edges


text:
Python - Attach property to current blend file
My goal
I'm currently working on an addon. I'm quite new to Python, but I'm fluent in programmation in general. My addon's goal is to speed up the process of naming output files, keep track of version number of each shot/scene, and other features in the future.
Most properties of my addon are per-scene (and working perfectly), but I also need to have a per-file property, like a global variable. As shown below, some properties are attached to the current scene (orange), while other properties should be attached to the current file (red).

The file-level property will be a main folder, containing other subfolders (one per Scene). I'm unable to implement that.
The scene-level properties will keep track of multiple informations on the current Scene. These properties are already working as I want it.
Here is a list of the conditions I want the property to satisfy :

The property should be unique inside the Blender file
All scenes should have access to this property
The property should not be shared between multiple Blender files.
(Redundant/trivial to say it but : any change of the property in one scene should update the property for all scenes.)

What I've found so far
I found some informations about that here. The only solution that corresponds to my condition is to have a dummy ID block and I have no idea what it is exactly (nor Google).
My question
How am I supposed to attach a property to the blend file, satisfying the conditions above ? Are dummy ID blocks the only way of achieving that ? If yes, how is it supposed to be implemented ?
Thanks for your time

i think he meant, that you just create a text (bpy.data.texts) which you maybe call "my global variables" and then you can add your custom properties to that text. e.g. bpy.data.texts["Text"]["a"] = 7. And i assume you know how you can create a new text and add custom properties to it ;) and since text is not scene dependant, i think that is a nice workaround/solution!

if you begin the data block name with a dot . eg .my_text it won't appear in the regular UI search so you can kind of hide it.

Thank you both ! I'll take a look at your answers, it should work for my case.

@Chris Did you mean bpy.types.text ? I haven't encountered text objects for now, and I couldn't find bpy.data.text in the documentation. https://docs.blender.org/api/current/bpy.types.Text.html

@Lutzi: yes, i mean exactly that. I don't understand your question!? your link leads to the right documentation... ;) [1]: https://i.sstatic.net/gz3GN.png

@Gorgious: nice! didn't know that!

ok, here a very "dumb" and small example:
bl_info = {
    "name": "New Object",
    "author": "Your Name Here",
    "version": (1, 0),
    "blender": (2, 80, 0),
    "location": "View3D > Add > Mesh > New Object",
    "description": "Adds a new Mesh Object",
    "warning": "",
    "doc_url": "",
    "category": "Add Mesh",
}

import bpy
from bpy.types import Operator
from bpy.props import FloatVectorProperty
from bpy_extras.object_utils import AddObjectHelper, object_data_add
from mathutils import Vector

def add_object(self, context):
    scale_x = self.scale.x
    scale_y = self.scale.y

    verts = [
        Vector((-1 * scale_x, 1 * scale_y, 0)),
        Vector((1 * scale_x, 1 * scale_y, 0)),
        Vector((1 * scale_x, -1 * scale_y, 0)),
        Vector((-1 * scale_x, -1 * scale_y, 0)),
    ]

    edges = []
    faces = [[0, 1, 2, 3]]

    mesh = bpy.data.meshes.new(name="New Object Mesh")
    mesh.from_pydata(verts, edges, faces)
    # useful for development when the mesh may be invalid.
    # mesh.validate(verbose=True)
    object_data_add(context, mesh, operator=self)

class OBJECT_OT_add_object(Operator, AddObjectHelper):
    """Create a new Mesh Object"""
    bl_idname = "mesh.add_object"
    bl_label = "Add Mesh Object"
    bl_options = {'REGISTER', 'UNDO'}

    scale: FloatVectorProperty(
        name="scale",
        default=(1.0, 1.0, 1.0),
        subtype='TRANSLATION',
        description="scaling",
    )

    def execute(self, context):

        add_object(self, context)

        #Added by me start
        context.object["read text property"] = bpy.data.texts["top secret"]["my custom property1"]
        context.object["read text property2"] = bpy.data.texts["top secret"]["my custom property2"]
        #Added by me end

        return {'FINISHED'}

# Registration

def add_object_button(self, context):
    self.layout.operator(
        OBJECT_OT_add_object.bl_idname,
        text="Add Object",
        icon='PLUGIN')

# This allows you to right click on a button and link to documentation
def add_object_manual_map():
    url_manual_prefix = "https://docs.blender.org/manual/en/latest/"
    url_manual_mapping = (
        ("bpy.ops.mesh.add_object", "scene_layout/object/types.html"),
    )
    return url_manual_prefix, url_manual_mapping

def register():
    bpy.utils.register_class(OBJECT_OT_add_object)
    bpy.utils.register_manual_map(add_object_manual_map)
    bpy.types.VIEW3D_MT_mesh_add.append(add_object_button)

    #Added by me start
    if bpy.data.texts.get("top secret") == None:
        bpy.data.texts.new("top secret")
        bpy.data.texts["top secret"]["my custom property1"] = 7
        bpy.data.texts["top secret"]["my custom property2"] = "that's the way"
    #Added by me end

def unregister():
    bpy.utils.unregister_class(OBJECT_OT_add_object)
    bpy.utils.unregister_manual_map(add_object_manual_map)
    bpy.types.VIEW3D_MT_mesh_add.remove(add_object_button)

if __name__ == "__main__":
    register()

The example is from Blender's python example -> add-on
I added these line:
if bpy.data.texts.get("top secret") == None:
        bpy.data.texts.new("top secret")
        bpy.data.texts["top secret"]["my custom property1"] = 7
        bpy.data.texts["top secret"]["my custom property2"] = "that's the way"

this creates your new text object with 2 custom properties (which are scene independent, because they are stored in text objects)
i also added these 2 lines:
context.object["read text property"] = bpy.data.texts["top secret"]["my custom property1"]
context.object["read text property2"] = bpy.data.texts["top secret"]["my custom property2"]

which read out the text custom properties and assigns them to the newly created object as their "own" custom properties.
Hope this helps a bit.

Update for Gorgious (because he answered my comment's question so quick and nice):
import bpy

if bpy.data.texts.get("top secret") == None:
        bpy.data.texts.new("top secret")
        bpy.data.texts["top secret"]["my custom property1"] = 7
        bpy.data.texts["top secret"]["my custom property2"] = "that's the way"

bpy.context.object["read text property"] = bpy.data.texts["top secret"]["my custom property1"]
bpy.context.object["read text property2"] = bpy.data.texts["top secret"]["my custom property2"]

you can copy paste this code and run it, but you should select an object before (e.g. your default cube).
If you watch your custom properties before you run the code, you will see, that there were no custom properties.
Afterwards you will have a new text object and 2 new custom properties on the text object and on your selected object.

by the way: i have no idea how you can "see" the custom properties of a text object - so if somebody knows, just let me know, i would add it to the answer. thx.

Interesting question. It is indeed possible. See https://blender.stackexchange.com/a/315216/86891 BTW I think your answer is good but maybe you can strip some code that doesn't really relate to the question, seeing as the OP is not really fluent with python. Cheers

I got it kinda working for a scene, but when creating a new scene, my property doesn't use the text. Is there somewhere in your code, where you instanciate the property's value based on the text data (if text exists) ? My understanding is that your solution doesn't work for multiple scenes.

Also, I don't understand what the left part from context.object["read text property"] = bpy.data.texts["top secret"]["my custom property1"] is supposed to achieve (in the OBJECT_OT_add_object class).

AFAIK the text objects are not dependent on scenes. So if yours are working only in one scene, maybe provide your code, how you are using it? I don't say that my "example" is super sophisticated, it just should show, how it works. The line just creates a custom property (read text property) for the active object and gives it the value of the custom property (my custom propterty1) of the text (top secret)


text:
Reduce text width to 0 (internal wire)
I'm unable to find even a starting point to this problem, so any guidance of any sort would be awesome. First a short paragraph on fonts.
Fonts
From what I know, fonts in general are described as (close oriented) curves. Multiple curves describe the area that should be filled, as shown here :

Here we have 2 curves for A, but for example there could be 3 for a B. Note that in my example, the width of the font is constant but that's not always the case (for example a in the next image)
My goal
I'm trying to go from this shape, which is basically a line with thickness, to really just a line. A sort of collapse of the width of the font to a wire text as below :

On the left is the process I want to achieve. On the right is a comparison before/after.
This process looks to me complex. For example, fonts are described as closed curves which
wouldn't be guaranteed in this wire-like state. Think of an i, where the bottom part would be just a line. To show you just one case where the process can become complex, let's take a look at the top of an A :

The original A (orange) have unrelated topologies, between the outter curve (2 points) and the inner curve (1 point). The process should probably create 2 points. I feel like there are a lot of edge-cases like that, for example how do you collapse a . (initially a circle/disc) : to a smaller circle, or to a point, ...
My conditions

To be somewhat procedural
So, no manual modelling
To work for this kind of fonts (basically, sans-serif with solid borders :

I would consider as acceptable answer if the solution only work for constant-width fonts (like most of the examples above). It would already be a great starting point.

To work for letters and numbers, if possible with usual characters too (,.- ...).

My question
Do you have any idea how to approach that problem ? Is there an easy way to achieve that ? Otherwise, would you know the name of a method or algorithm ? Or do you think it's impossible to implement a general solution, under these conditions ?
Any help would be greatly appreciated. Thank you for reading me !

There are may different fonts and many different characters. I don't think there is a practical general solution☻Character "A" does not represent the actual problem, which is way more complex.

I mean... what do you do with this one, or this one, or even this one?.. This cannot even be done manually.

I was thinking of simpler fonts, I've updated the question with a few examples. Thank you for your comment.

@MartynasŽiemys If you have an answer even for just one font of your choosing, I'll gladly give the bounty. I'm searching for a starting point, so that I can extend it myself. Starting point that I haven't found yet.

I suspect this to be a way more complex problem than it seems at first. It might be easier to do it manually. What do you need this for? Maybe it's possible to solve the original problem easier.

I know it can appear quicker to model it manually. I'm not looking for speed but for procedurality. I think I should probably open another question with my specific application, otherwise my question will become too broad. Basically, I wanted to have animated electricity-like text, where the width is constant but with small scale noise offset. It has been the 3rd or 4th time I had to kill a creative idea because I would have needed a 0-width text. I still hope there is an solution or a half-solution to this.

@Lutzi This is the best I could come up with in the hope of getting a general solution: https://blend-exchange.com/b/xYvorWeE

@ugorek Please consider posting it as an answer (and maybe get the bounty). That's an interesting solution ! Some imperfections but it looks like it's working. Thank you :)

Look at this vectorization of thick lines.

@ugorek Why my blender is crashing, when I try to open your file?

The first thing that comes to my mind would be to move two curve points to there common center, when they satisfy certain criteria, such as being at shortest distances, neighboring points are reached on a non-vanishing angle with respect to the connecting direction, the relevant directions should be vertical or horizontal most of the time (except for the 'S' and the 'O' for instance). I guess I could do this with a script but I had no idea, how to achieve this procedurally.

@Leander Thanks for the paper ! At least I know I have a method that works.

@p6majo I think there are a lot more edge-cases. Only a few letters are composed of horizontal and vertical straight lines.

Probably related but manually https://blender.stackexchange.com/a/297332/2214

(Using Blender 3.6.8)

Searching to characterize curves connecting outlining curves to backbones, it was observed that backbones could be defined as intersection of surfaces extruded from outlining curves. A new approach was derived, not relying in particular on thresholds. It is reported in an other post. The present research is postponed.

Research Progress Report
The results reported are not satisfying, but show some perspective of improvements.

This figure illustrates, with black dots, preliminary control points from which curves could be defined, for characters of varying complexity.
Approach
The detection of the backbone of a character relies on the distance to the curves defining its outline, and on assumptions about its shape. Two grids are used. The distance and its gradient are computed on a fine grid, to identify points along ridges. The statistical local organisation of subsets of ridge points is analysed using a coarse grid, to identify pieces of curve.
Information from the fine grid

This figure illustrates the distance to outlining curves. This field is normalized between 0 and 1 per character. White is below 5% ; Green is below 25% ; Blue is below 50% ; Magenta is below 75% ; Yellow is below 95% ; Red is above.
It is to notice that useful control points (black dots) are above 50%, and also that the maximal distance is obviously varying along a ridge for not constant-width characters (like B and é). But even for constant-width characters (like A and X), local maxima are located at crossings.
Information from the coarse grid

This figure illustrates basic information inferred by analysing the ridge points (in light grey) clustered per face of the coarse grid. The preliminary control points (in black) are computed as the barycentre of such clusters. Green faces are empty of ridge points. Blue faces are undersampled and the ridge points of these should be transferred to a neighbouring face ; otherwise, statistical analysis is biased. Dark grey faces are yet to analyse to identify strait or curved segments, crossings, extraneous segments connected to outlining curves, isolated points, ...
GeometryNodes modifier overview

1. The coarse grid dimension is hardcoded to 8x8 faces. Each face is then divided into 16x16 smaller faces to define the fine grid.
2. The Target group node is providing the surface from which the distance is computed.
3. The Distance group node is building the fine grid, it is tagging independent parts for multi-parts characters, and it is computing the normalized distance.
4. The Gradient Edge group node is computing the distance gradient components along X and Y per edge.
5. The Gradient Vertex group node is assembling the distance gradient components per vertex. It is also tagging points where the slope goes from increasing to decreasing. Such points are candidates as ridge points.
6. The Ridge group node is filtering candidate points by limiting the distance gradient slope according to a user-defined Threshold, and by discarding points with distance below 1% (hardcoded). As the distance gradient is discontinuous along ridges, it is expected that its magnitude is below 1. So the Threshold is set to 0.98 by default.
7. The Filter group node is building the coarse grid and it is assigning the ridge points to coarse faces. Then subgroup nodes are used to apply local analyses, like detecting empty or undersampled faces.
Gallery
(NB :The following pictures are illustrating intermediate results, without intent to be fully descriptive.)
Extruded surface to compute the distance and to tag independent parts:

Fine grid with Z equal to the distance. "Outside" points are set with negative distance:

Tagging of "inside" fine grid points with independent parts ID taking advantage of the Mesh Island node:

Gradient of the distance evaluated at vertices, from the gradient computed per edge:

Candidates as ridge points where the gradient sign is changing at least in one direction, X or Y:

Filtering of candidates to tag ridge points:

Duplication of the coarse grid, one copy per independent part:

Perspectives

Join undersampled faces.
Use simple linear regression to identify strait segments.
Use simple linear regression to identify extraneous segments connected to outlining curves.
Use islands detection to identify isolated points.
Identify curved segments from remaining faces.
Identify junctions from remaining faces.
Read from someone using Blender version above 3.6.8 with more advanced nodes, like Points to Curves node.

Resources

As this work is still under progress, I do not write detailed description of the GN sub-graphs as these might change to support new features. Some are already version number 3 after complete redesign...

(Using Blender 3.6.8)
Reseach Progress Report
The reported approach, yet incomplete, shows promising results.

This figure illustrates identified "backbone" curves for characters of varying complexity, using a Curve to Mesh node with a Curve Circle profile.
Approach
The detection of the backbone of a character relies on the distance to the curves defining its outline. It is observed that this distance grows linearly along the local line perpendicular to the outlining curve for each point along this curve. Rotating such a line built in the (X,Y) plane along the local tangent to the curve by 45 degrees defines the steepest path toward the ridge where lies the searched backbone.
Edges sampled along the outlining curve are extruded "at 45 degrees" to build faces to intersect. The same way, points are sampled along the outlining curve and a Raycast node is used to compute the intersection along the ray rotated "at 45 degrees". Because these sampled points are connected in a Mesh Line, the resulting intersection defines a list of connected edges, that are afterwards converted to a curve.

This figure illustrates the process for the "O" character. The original curves are divided in four "rims" which are extruded inwards "at 45 degrees". Adjacent faces of same colour belong to the same rim. Each rim is also sampled with points that are shifted along rays "rotated at 45 degrees" until intersecting opposite faces. Intersections are identified with cubes. To avoid self-intersection, the configuration is duplicated along the Z axis, with the faces associated to one single rim deleted per copy.
GeometryNodes modifier overview
(NB :The following pictures are illustrating intermediate results, without intent to be fully descriptive.)
Main graph

1. The Rim group node is splitting the original curves in "rims" connecting two adjacent control points.
2. The Extrude Rim group node is building the faces to intersect from the previously identified rims.
3. The Corner group node is storing data about each control point, including its two adjacent rims and it is computing the bisector between.
4. The Extrude Corner group node is building the faces to intersect for concave corners.
5. The Intersect group node is computing the intersection from rays emitted by sampling the rims, with the faces built previously.
6. One list of connected edges per rim is produced. No filtering is applied at this time.
Identifying the rims

1. Rim data are stored in a "table" (as a Grid) with two columns (along X axis), one per end, and with as many rows (along Y axis) as pairs of adjacent control points. It is assumed that curves are cyclic.
2. In this table, only edges connecting ends (i.e. aligned with X axis) are kept. So data stored per rim (i.e. per edge) are safely transferred to ends (i.e. points).
3. The Rim Left and Rim Right group nodes are retrieving data from the original curve control points to define both ends. In particular, position, tangent vector and factor are stored.
4. Strait rims are detected by checking aligned tangents and connecting segment. These are tagged with type Vector (i.e. 2), following the handle types nomenclature.
Building from the rims the faces to intersect

1. The Rake group node is uniformly sampling each rim. Samples are stored as a Mesh Line to preserve connectivity between adjacent points. Linear interpolation in (X,Y) is used for strait rims. For curved rims, the factor is interpolated, then a Sample Curve node is used to recover the local position and tangent.
2. The achieved edges are extruded along the Z axis. Then the Top vertices are moved by rotation, around the local tangent, of the vector connecting them to the curve. This is how the "extrusion at 45 degrees" is achieved.
3. It is to notice on the picture above that "gaps" are remaining between extruded patches when the angle between adjacent rim tangents is larger than 180 degrees (e.g. between red and green faces at mid-height junction).
Computing the bisectors

1. Corner data are stored in a Point Cloud, one point per original curve control point.
2. From the left and right handles, the bisector at each corner is computed.
3. It is to notice that tangents are usually aligned at the junction with curved rims, leading to a singular case for the bisector algebra. For this special case, the bisector is recovered by rotation of the unitary vector along Z axis around the local tangent, by 45 degrees.
4. Corners with angle between left and right handles larger than 180 degrees are tagged as "concave".
Building from the concave corners the faces to intersect

1. It is observed that the "distance from a point" function level set is a cone of 45 degrees half-angle, i.e. with Depth equal to Radius Top.
2. As a corner is shared by two adjacent rims, only a half-cone is kept, requiring an even number of Vertices.
3. The achieved faces are slightly shifted along the Z axis to avoid self-intersection with cone apex.
4. Half-cones are instanced at each concave corner.
5. The half-cone X axis is aligned with the bisector direction vector projected in the (X,Y) plane.
6. It is to notice on the picture above some failure at the junction between the two outer curves. Two cones are almost superimposed, with a full pink one. This is because two control points are very close there ; these should have been merged beforehand.
Computing the intersections

1. Let $N$ be the number of rims. There are $N \times (N-1)$ combinations of two different rims to intersect.
2. To compute the intersection of rim of index $i$ with all rims of index $j$ such that $j \neq i$, the extruded faces are duplicated $N$ times along the Z axis. This yields $N \times N$ combinations. Then for the $i^\textrm{th}$ copy, faces belonging to rim $i$ are deleted to avoid self-intersection. This yields the sought $N \times (N-1)$ combinations.
3. Afterwards edges belonging to each rim $i$ are shifted along the Z axis to the "height" of the $i^\textrm{th}$ copy.

1. A Raycast node is used to compute the intersection. The Source Position is set to the position of points sampled along a rim. The Ray Direction is recovered by rotation of the unitary vector along Z axis around the local tangent, by 45 degrees.
2. The figure above illustrates the process for the first two rims of character "B". Cubes are instanced at the Hit Position to visualise intersections. Black strait lines are drawn only to visualise rays ; these are not involved in computing the intersection (Mesh Boolean node is not used).

1. This figure illustrates one of the most complex configuration that will require further research.
2. A single rim is intersecting two different curved rims (in yellow and blue, from left to right). Between, it is intersecting the cone from a concave corner (in pink).
3. So this rim yields at most three pieces of curve along the backbone. Ends should be computed to refine the junction between these adjacent pieces of curve.
4. An other improvement could be in removing the part along the cone, to keep only two pieces of curve.
Perspectives

Merge by distance control points from the original curves that are too close together ; these yield near singular cases easier to remove than to solve.
Remove duplicated backbones from the same both intersecting rims.
From a very dense sampling of backbones, identify underlying curves (in particular strait ones) to reduce as much as possible the number of final control points.
Remove curves connecting the backbone to the outlining curves.
Identify crossings of strait curves to remove the portion along extruded cones (from concave corners) and to bridge gaps.
Investigate the singularity of the dot character (.).

Resources

First, offset slightly away from original shape, then iteratively offset more from the nearest edge of the original shape:

Imgur mirror (SE image hosting has problems)
 Imgur mirror
As you can see, it stabilizes when the loose ends completely dissolve and only a closed loop remains. Also there is a number of possible issues to solve here:

Sometimes a font will define a glyph somewhat incorrectly by defining a path outline of a self-intersecting stroke like in the default font and lowercase greek letter phi "φ", so that needs to be recalculated to have an outside and inside outline of the ink. See: How can I merge overlapping faces converted from a text string in geometry nodes, to avoid Z-fighting issues during rendering?
Also above there's a fix (I think both me and quellenform find a fix for that) for when the generated curve has a normal pointing inwards, which is bad for the algorithm that relies on normal to move inwards.
If you discover further problems please [Edit] this answer and add a bullet point above this one.

So with the above problems solved, there's still the problem of the loose ends:

Imgur mirror
I needed a distance to the edge to know how hard to pull towards it to automatically balance the other forces - if the loose end moves too much from the edge, pull it harder. So here's the implementation of the "Fix":

Imgur mirror
Result:
 Imgur mirror
OK, there's still a problem of the loose ends remembering their direction too well [actually it's not that, as I realize later]. I was hoping this won't happen due to position blur. I didn't want to just pull towards the nearest edge, because I was afraid by the time the loop collapses to produce a loose end, it will be too far from the good edge. And indeed, I added an additional force to the nearest edge and that's what happens:
 Imgur mirror
If you adjust the forces, you can kind of make it work, So if instead of "Distance" you pass the "Geometry Proximity: Position" to the "Fix", and update the "Fix" to:

Imgur mirror
Then you get the following result:
 Imgur mirror
But now the tail receded too much!
It just occurred to me: the first "Fix" was correct. See, we humans analyze the shape on high abstraction level: We understand it's a stroke, and we understand how the stroke was drawn, with the brush having (in this case) vertical orientation and swiping right. Therefore we expect the generated middle curve to follow the center of the brush. However, this information is lost, and you can't program complex human imagination in. Well, in the age of AI, you kind of can, not in geometry nodes, though. So you need some kind of a heuristic to figure out when to treat a "V" shape as symmetric around the tip, and when to detect it's a part of the beginning of a stroke. Perhaps something as easy as detecting vertical edges could work... What about cursive, though? So when you tell the program to try to extend the curve as much as possible while avoiding touching edges, the behavior of the first "Fix" is exactly correct...


text:
Evee lights are not showing/shining, beside the sun
I having some trouble in evee about the lights. My other project work fine but for some reason the light which includes the point,spot,area. I do not know if it was a setting I change or what. This is the version 2.83.20 of blender. (Sorry if this is a noob question, I am new to this software)
What I did: Turn high quality normals.

Hello maybe share your file or at least show a screenshot of your whole interface

I just edit the question the screen shot of the light not shining should be on there

could you please share your file? https://blend-exchange.com/

I think that is it... sorry if the file in blender is messy lol

I'm not sure what problem you're talking about, there are 2 suns and they seem to both work the way they should, could you please elaborate?

If you add a  point light or any other light beside the sun it does not shine?? The only light that works is the sun

It works with any other kind of lamp, it's just that 1) the strength needs to be much higher 2) your material is black 3) as you have overlapping vertical objects and they all have their own material, when you change their material you may not see the change right away

Thank you so much... sorry if it was a stupid question

If you create a new light, make sure that its strength is high enough, 4 is ok for a Sun but not for a Point, increase it up to 4,000 (or more, depending on their proximity to the object).
As a side note, your vertical blocks are overlapping and have different materials, and you've disabled the Scene World option in the Viewport Shading panel.


text:
Jagged shadows in EEVEE even with highest cascade / Cube size
I was working on a scene, in EEVEE, the shadows looked great, and after working on the geometry for a while, I noticed the shadows look jagged and really low-res. Here's the comparison between an older version that looked fine and the current jagged version :

I still have the same Render settings with the Cube size and Cascade size set at 4096px.
When I copy all my new models in the old file, the shadows look fine, so it has to be a setting on my new file that broke the shadows. Is there another setting I might have missed and changed by accident that changes the quality of the shadows?
I figured out it was a problem with my camera because if I import the old camera into the new file, the shadows look fine. I'd still like to know what causes it because AFAIK every setting between the two cameras are similar.
I added a minimal file that shows the problem, you can switch between the two cameras in the Scene tab, and you'll see the issue :

It might be helpful to people trying to help you if you uploaded an example blend file to the site https://blend-exchange.com and add that link in the question.

@RickT Thanks, I added a minimal test file that shows the weird behavior.


text:
Glare effect different when rendered than from viewport
No idea why this happens, the glare/lense effect I added looks fine in the viewport with the Compositor enabled, but when I render it looks way different :
Viewport Display :

Render Display :

I'm using EEVEE, here's my Compositor setup :

Here's a minimal test file showing the problem :

Hello and welcome. Did you enable Bloom in your properties?

@HarryMcKenzie Hello, I did. However it shouldn't matter because the bloom comes from the Glare Node I'm using in the Compositor, so it appears either way in viewport, and never appears acorrectly in render.

i thought the glare node only works for Cycles

No it also works in EEVEE. It's just that for some reason, the render and the viewport don't match

Hello, maybe share your file? (only share the useful objects)

Hello @moonboot, thanks, I added a minimal test file in my post !

I wonder if the problem is that some nodes still don't work correctly in real time viewport compositing, so maybe you should better enable the Background option of the Compositor and only count on it for the moment?

right. I think I figured out what happens : in Viewport, the Glare Node is actually emulated through a Bloom effect, which does not look the same as the actual Glare effect in the Render. My solution is to just setup the Bloom right and not use Glare.


text:
Trying to Turn Multiple Cylinders(parts) into a curve
I have an obj file of some roller coaster track, specifically the rails by themselves. It is not well-optimized and is made up of multiple cylinder models all lined up one after another to create the rails(yes, not good)
I've been trying to find a way to convert this into a curve or something similar in Blender so it can be optimized.
I've been using Blender for a while but there is still a lot I don't know. I can't seem to figure this out. If someone has any idea on how I could accomplish this I'd really appreciate it. Thanks!
Edit: here is a picture of the mesh

Cylinders are cut into 4ths:

Some thing like a roller coaster track can be made procedurally using geometry nodes. Are you comfortable with those?

Show  picture of the mesh. It's hard to tell what you are working with and the easiest solution otherwise. If it's that bad the easiest would probably be to just make a cuve and place it manually to overlap the cylinders

Thanks for commenting. I would prefer not to have to recreate the mesh by hand. I feel like each piece is close enough to another that there might be a good way to just convert it. I have not used geometry nodes in Blender before, I will look into that too.

For something like that select one of the vertices in the center of the end faces, then shift+G->Amount of connecting edges. This should select all the center vertices.

With all of them selected, hit ctrl+X to dissolve them so that the circles at the end of each cylinder become a single face.
Then select one of those faces and Shift+G -> Polygon sides. This will select all the round faces.

Then, with the pivot point set to individual origins, scale them to 0. Then merge the vertices by distance. This Should leave you with a single line of vertices

You can give it a subdivision modifier to make it smoother and use a skin modifier and subdivision to get a cylindrical rail. Or you can convert it into a curve and use another curve as the profile

This is so close! It seems the cylinders are made up of 4 pieces each(they are quartered at the rounded face, like how a pie is cut) and after dissolving them I'm not left with one round face but 4 quarter faces, so I'm not able to get the end result you did. I'll add a screenshot above.

With the quarter faces selected like that you should be able to merge the vertices by distance. This should at least merge the center vertices on all the faces. That will treat them like a single object then that you can scale to 0 on individual origins to get the same end result

Yes, you are correct! this is awesome thank you so much!!


text:
GLSL: 2D space transform matrix of Custom Shader
Here is a template of build-in shader to draw a 2D Rectangle in viewport and that is good.

import bpy, gpu
from gpu_extras.batch import batch_for_shader

vertices = (
    (100, 100), (300, 100),
    (100, 200), (300, 200))

indices = (
    (0, 1, 2), (2, 1, 3))

shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices)

def draw():
    shader.bind()
    shader.uniform_float("color", (0, 0.5, 0.5, 1.0))
    batch.draw(shader)

bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')

Here is my custom shader to draw a gradients rectangle and that is bad when draging the region.

import bpy, gpu
from mathutils import Matrix
from gpu_extras.batch import batch_for_shader
from bgl import glEnable, GL_BLEND

vertex_shader = '''
    uniform mat4 winMat;

    in vec2 position;
    out vec2 pos;

    void main(){
        pos = position;
        gl_Position = winMat * vec4(position, 0.0, 1.0);
    }
'''

fragment_shader = '''
    uniform vec4 color;
    uniform vec4 LRBT;
    uniform float d;

    in vec2 pos;
    out vec4 FragColor;

    float c;

    void main()
    {
        if (pos[0] < LRBT[0] + d){
            c = color[3]/d *(pos[0] - LRBT[0]);
        }else{
            if (pos[0] > LRBT[1] - d){
                c = color[3]/d *(LRBT[1] - pos[0]);
            }else{
                c = color[3];
            }
        }
        if (pos[1] < LRBT[2] + d){
            c *= color[3]/d * (pos[1] - LRBT[2]);
        }else{
            if (pos[1] > LRBT[3] - d){
                c *= color[3]/d *(LRBT[3] - pos[1]);
            }
        }

        FragColor = vec4(color[0], color[1], color[2], c);
    }
'''

vertices = (
    (100, 100), (300, 100),
    (100, 200), (300, 200))

indices = (
    (0, 1, 2), (2, 1, 3))

viewMat = Matrix((
    (0.0009, 0.0000, 0.0000, -0.7200),
    (0.0000, 0.0009, 0.0000, -0.4674),
    (0.0000, 0.0000, 0.0000, -1.0000),
    (0.0000, 0.0000, 0.0100,  4.2783)
))

shader = gpu.types.GPUShader(vertex_shader, fragment_shader)
batch = batch_for_shader(shader, 'TRIS', {"position": vertices}, indices=indices)
shader.uniform_float("color", (0.5, 0.5, 0.5, 1.0))
v = vertices
shader.uniform_float("LRBT", (v[0][0], v[1][0], v[0][1], v[2][1]))
shader.uniform_float("d", 30)

def draw():
    glEnable(GL_BLEND)
    shader.bind()
    shader.uniform_float("winMat", bpy.context.region_data.window_matrix @ viewMat)
    batch.draw(shader)

bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')

It can maintain the size and location when pan/rotate the viewport. But it is invalid when I drag to add more viewport in the workspace. You can see the size and region position of the rectangle are changing. I don't want the rectangle to change size and position when I drag or enlarge the viewport (of the right hand side in the image)

So the question: What is the correct transform matrix of the shader? or a method to fix this problem just like the build-in shader.

So instead of looking like this: BAD you want it to look like this? GOOD Your 2nd code posted seems irrelevant to the issue.

Thank you for your attention, I provided additional information to clarify the problem.

If you draw a rectangle with the built-in shaders, they all use ModelViewProjectionMatrix.
The documentation states:

"...They all read the uniform mat4 ModelViewProjectionMatrix, which can be edited by the gpu.matrix module."

Therefore, it might be a solution to use the same matrix for your custom rectangle.
Replace the line:
shader.uniform_float("winMat", bpy.context.region_data.window_matrix @ viewMat)

with the following:
shader.uniform_float("winMat", gpu.matrix.get_projection_matrix())

With this you draw a rectangle with the gradient you defined before.

Perfect, the problem is solved.


text:
Check if any popup is running in 3D viewport
How to check if any popup is running in 3D viewport like adjust last operation menu, not include N-Panel, gizmo

I'm looking for a way to check if it's running to resolve my addon bugs in blender 4.2.
Script for test
import bpy

class ObjectDev(bpy.types.Operator):
    bl_idname = "object.dev"
    bl_label = "object dev"

    def modal(self, context, event):
        if event.type == "ESC": return {"CANCELLED"}
        print(context.space_data.show_region_hud)
        # print(context.region_popup)
        # always get True/None

        return {'PASS_THROUGH'}

    def execute(self, context):
        context.window_manager.modal_handler_add(self)
        return {'RUNNING_MODAL'}

def register():
    bpy.utils.register_class(ObjectDev)

def unregister():
    bpy.utils.unregister_class(ObjectDev)

if __name__ == "__main__":
    register()

Keymap: object.dev

So far I've tried:

context.region_popup
Run the operator object.dev, it print None, then call a panel, it still print None.
context.space_data.show_region_hud
Same way it always get True

I would check https://docs.blender.org/api/current/bpy.types.SpaceView3D.html#bpy.types.SpaceView3D.show_region_hud ?

I checked context.space_data.show_region_hud in a PASS_THROUGH operator it always get True

And I checked all attrs in context.space_data, no one swapped when I open a popup.

Are you sure context.space_data links to your 3D viewport ? Where is your operator called from ?

Sure. I run the operator via shortcut in 3D viewport, See script above.

I found that the Adjust Last Operation panel is located in a region of type 'HUD'. The only method I found to determine its visibility is by checking the x and y coordinates of this region. If both x and y are greater than 0, the panel is visible; if both values are 0, the panel is not visible. This is the only reliable method I found to infer the panel's visibility based on its coordinates. The width and height remain greater than 1 even after the panel is hidden, so checking x and y values is the only effective way to determine its visibility. Hopefully this will help you further investigate better methods.
import bpy

class ObjectDev(bpy.types.Operator):
    bl_idname = "object.dev"
    bl_label = "Object Dev"

    def modal(self, context, event):
        if event.type == "ESC":
            return {"CANCELLED"}
        if self.is_adjust_last_operation_panel_visible():
            print("The 'Adjust Last Operation' panel is visible.")
        else:
            print("The 'Adjust Last Operation' panel is not visible.")
        return {'PASS_THROUGH'}

    def execute(self, context):
        context.window_manager.modal_handler_add(self)
        return {'RUNNING_MODAL'}

    def is_adjust_last_operation_panel_visible(self):
        for window in bpy.context.window_manager.windows:
            screen = window.screen
            for area in screen.areas:
                if area.type != 'VIEW_3D':
                    continue
                for region in area.regions:
                    if region.type != 'HUD':
                        continue
                    if region.width > 1 and region.height > 1 and region.x > 0 and region.y > 0:
                        return True
        return False

def register():
    bpy.utils.register_class(ObjectDev)

def unregister():
    bpy.utils.unregister_class(ObjectDev)

if __name__ == "__main__":
    register()

This is a great help, thank you.

@XY awesome I hope you can find a better solution though then let us know later if you find out :)


text:
RG(B) Map to create a toon/cel face shadow mask
First time modelling a proper anime-style character. I've been trying to create some smoother toon/cel shade-style shadows for the face of a character, I saw an idea used for Unreal that used an RGB map where the Red channel was for light hitting the character's left, and the Green channel was for light hitting their right, and am wondering if there's a way to recreate that effect in Blender (or something decently close)

Based on: https://www.artstation.com/artwork/wJZ4Gg
The main issues I've been having are working out the setup and order of the nodes, and masking the result somewhere so it only affects the skin (UV map includes eyes, mouth, etc which shouldn't be shaded in the same way)

If there's some alternate methods to get some cleaner shadows in a toon/cel style I'm open to getting some direction there! I've tried following some other tutorials and haven't had much success. (trouble getting 'copy/paste vector' to work and personally don't like the inflexibility of the 'connect a driver to a light object' method)
Some examples of the intended effect at the two extremes:

Example video of how the shadows should react: https://youtu.be/Ty21Cf7abrY

Heyo, just updated the post, hope it's helpful

Very interesting method, how did you create the red-green mask? With the script listed in the Artstation link?

I made a custom image in a painting software (Clip Studio in my case), I had a greyscaled version that I tried using in an earlier attempt. I made a layer over it of just red set to multiply and merged, then did the same for green. Lastly, flipped the green layer horizontally and set it to screen.
In terms of the link's script, that's basically where I'm having trouble achieving that result in Blender.