godotengine / godotengine/godot-docs

Line2D texture mapping details/behavior

Open
#10,297 3 comments 0 reactions 0 assignees View on GitHub
area:class reference enhancement topic:2d
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:** v4.2.2.stable.official [15073afe3]

**Issue description:** Details on how texture mapping works with Line2D.

**URL to the documentation page (if already existing):** https://docs.godotengine.org/en/stable/classes/class_line2d.html

----

I thought clarification/details on how the texture maps to the Line2D given settings is in order.

When using the "width curve", the width_curve value appears to be a multiplier to the width specified in pixels for actual width of line as interpolated along.

When making a change to the texture width (or other settings), you may need to toggle visible off/on to see update.

As for texture mapping to line. These results were obtained using a 2D Linear Gradient Texture.
* When using line width of 10 pixels, and a texture of 256 width x 256 height. UV appears to be wrapping at 10 pixels wide.
* When using line width of 10 pixels, and a texture of 256 width x 64 height. UV appears to be wrapping at 40 pixels wide.

Therefore, it seems for texture mapping the line. The height of texture relates to the width of line. Wrapping of the "U" coordinate will happen at TEXTURE_WIDTH / TEXTURE_HEIGHT * LINE_WIDTH (in pixels).

---

It strikes me this sort of documentation would be helpful to know how to use the Line2D. Is the above reasonable to expect from the documentation? Is the reason it is not there already is due to massive nature of documenting everything?

It would be helpful for me to make an update and do a pull request? Are examples desired as above, or just the technical detail?

Is it a bug that I must toggle visibility to update, or reasonable to expect and perform when making these sorts of changes.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Line2D documentation page linked in the issue and verify the reported texture mapping and visibility-update behavior against Godot 4.2.2. Done means determining which behavior is expected and documenting the relevant technical details or examples, if the project confirms they belong in the page.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.