3d-sky-rays
Skill này làm gì
Skill này hướng dẫn agent thêm các tia sáng mặt trời nhìn thấy được vào cảnh 3D. Nó dành cho lập trình viên làm cảnh ngoài trời hoặc cảnh giờ vàng, nơi ánh sáng xuyên qua khe hở.
Khi nào nên dùng
- ✓Khi ánh nắng nên hiện thành tia xuyên qua cây hoặc mép mái nhà.
- ✓Khi một cảnh kiến trúc giờ vàng cần các tia sáng.
- ✓Khi các tia sáng nên di chuyển đúng khi máy quay di chuyển.
Liên kết skill
https://github.com/MengTo/Skills/blob/main/agent-skills/3d/3d-sky-rays/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Thêm tia nắng xuyên qua cây trong cảnh công viên 3D của tôi lúc hoàng hôn.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent tạo một mặt nạ phân biệt bầu trời trống với vật chắn, rồi làm mờ ánh sáng lan ra từ vị trí mặt trời. Các tia bị cắt bởi hình dạng thật trong cảnh như cây và mái nhà.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
3D Sky Rays
Make the light appear to travel through gaps in the scene. Roof edges and foliage should shape the shafts as the camera moves.
Fit the existing renderer
Inspect the renderer version, render targets, alpha usage, depth path, tone mapping, and post-processing order. Keep the existing WebGL or WebGPU backend. The shader recipe below describes a WebGL screen-space effect; implement the equivalent in the project's node/render pipeline when using WebGPU.
Use one normalized world-space direction pointing toward the sun for the sky, ray source, and directional lighting. If the art direction deliberately offsets the visible sun from the lighting sun, document and control that offset in one place.
Build an occlusion-aware ray pass
- Render scene color in linear HDR. Obtain a mask identifying open sky: white for sky, black for opaque occluders. Match foliage alpha cutouts and vertex motion in the mask pass so leaves do not become solid rectangles.
- A dedicated sky mask is the portable default. Reusing scene alpha is an optimization only when every preceding pass preserves its meaning: sky alpha 0, opaque geometry alpha 1. Transparent glass, particles, canvas compositing, and AO can break that convention; inspect the mask directly.
- Project a point along the sun direction from the camera. Reject a source behind the camera before using projected coordinates. Convert NDC to UV with
uv = ndc.xy * 0.5 + 0.5; account for the pipeline's texture orientation. - For each ray-buffer pixel, march toward the sun UV. Sample sky visibility multiplied by sky brightness above an HDR threshold. Accumulate decaying samples and divide by the sum of weights so sample-count changes do not change exposure.
- Reject UVs outside the mask texture. Fade the effect as the sun moves far off-screen; clamping samples to the edge creates bright bands. A small overscan margin is useful for a sun just outside the frame.
- Composite the ray color additively into linear scene color before the final tone-map/output transform. Preserve the input alpha if later passes need it.
Core accumulation, expressed as pseudocode:
step = (pixelUV - sunUV) * density / sampleCount
sampleUV = pixelUV - step * jitter
sum = 0; weightSum = 0; weight = 1
repeat sampleCount times:
sampleUV -= step
if sampleUV is inside the texture:
energy = max(luminance(scene(sampleUV)) - threshold, 0)
sum += min(energy, energyCap) * skyMask(sampleUV) * weight
weightSum += weight
weight *= decay
rays = sum / max(weightSum, epsilon)
Use aspect-correct distance from the source for radial falloff. Keep any angular variation broad and subtle; the scene occlusion should provide most of the structure. On opaque foreground surfaces, attenuate the screen-space overlay strongly so wood and stone retain contrast. This is an artistic approximation, not a substitute for depth-integrated volumetric scattering.
Tune appearance before cost
Start with a low sun, warm neutral tint, visible gaps, and restrained intensity. View from behind a roofline and through a canopy. Whiteout usually means excessive intensity or a bad mask, not insufficient bloom.
Use roughly 24–48 samples and a half-resolution ray buffer as a starting experiment; increase only when visible banding warrants it. Seijaku's reference uses 72 samples, which is a reference choice rather than a required quality floor. Smooth noise jitter can reduce bands, but animated jitter can shimmer; use stable noise for still or reduced-motion views unless temporal accumulation is available.
Skip the pass when its contribution is zero. Resize its buffers with the drawing buffer, dispose replaced targets, and measure its incremental GPU/frame cost with rays enabled and disabled. Avoid synchronous GPU readback in the render loop.
Verify
- Roofs and leaf silhouettes visibly interrupt shafts; no rectangular foliage halos.
- Turning away from the sun removes the effect without a mirrored source or flash.
- Entering an interior preserves surface contrast; unrelated emissive objects do not become suns.
- Camera orbit, portrait resize, dusk, and a static reduced-motion frame remain stable.
- Desktop and mobile checks include shader errors, frame time, and the actual ray-buffer size.
Reference
Read REFERENCES.md for the source and renderer documentation. In Seijaku, inspect GodRayShader, makePost, and the projected-source update. Its alpha-mask conven
Câu hỏi thường gặp
Có hoạt động với WebGPU không?
Skill mô tả một phiên bản WebGL và yêu cầu xây dựng phiên bản tương đương trong đường render WebGPU.
Tại sao lá có thể trông như những hình chữ nhật đặc?
Skill cảnh báo rằng mặt nạ phải khớp với các hình cắt của lá, để lá không biến thành khối đặc.
Hướng mặt trời có được đặt ở một nơi không?
Có. Skill khuyên dùng một hướng đã chuẩn hóa chung cho bầu trời, các tia sáng và ánh sáng.
Chi tiết
Mô tả gốc của tác giả
Add sun shafts and crepuscular rays to a Three.js or equivalent 3D scene, using scene occlusion, a projected sun position, controlled foreground spill, and scalable post-processing. Use for rays of light from the sky, sunlight through trees or roofs, and golden-hour architectural scenes.
repo: MengTo/Skills
Độ phổ biến
- Sao GitHub
- 7.2k
- Vị trí xếp hạng
- #13323
- Giấy phép
- MIT
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
3d-cloth-material
7.2kGiúp agent của bạn tạo vải dệt 3D trông thật trong Three.js, với sợi dệt, ánh bóng nhẹ, nếp gấp tự nhiên, viền gấu và đường may.
3d-falling-leaves
7.2kGiúp agent của bạn thêm lá rơi chân thực vào cảnh 3D, với lá xoay tròn, trôi theo gió và được tái sử dụng khi máy quay di chuyển.
3d-four-seasons
7.2kGiúp agent của bạn thêm diện mạo xuân, hạ, thu, đông vào cảnh 3D, thay đổi cây cối, ánh sáng, bầu trời và tuyết mà không cần dựng lại cảnh.
3d-high-poly-models
7.2kGiúp agent của bạn dựng mô hình 3D chi tiết với hình dạng mượt và cạnh trông thật, rồi tạo các phiên bản nhẹ hơn chạy tốt trên web.
Skill tương tự
angular-developer
280kGiúp agent của bạn viết code Angular và tư vấn cấu trúc dự án, hữu ích khi bắt đầu dự án mới hoặc cải thiện hiệu suất.
frontend-a11y
280kGiúp agent của bạn làm cho giao diện web dễ tiếp cận với mọi người. Đảm bảo website và ứng dụng hoạt động tốt với trình đọc màn hình và điều hướng bằng bàn phím.
frontend-patterns
280kGiúp agent của bạn áp dụng các mẫu hiện đại trong phát triển frontend. Tối ưu hiệu năng, quản lý trạng thái và tuân theo thực hành tốt nhất với React và Next.js.