texture2D in custom 2D filters can get texture outside of game, resulting in ugliness #23375

Closed
opened 2010-08-18 20:08:54 +02:00 by Jacob F · 8 comments

Category: Rendering

%%%As an example here is an attached .blend containing a simple star 2d filter.
Everything looks great -- but what are those ugly artifacts around the edge? Well it's obviously the controls from outside of the game window being pulled in. Probably it should be black out of the game window - or better - extended, but I don't know how it works. I don't want to check if the pixel it's computing with is in the game window because all the extra math and if then's slow down the filter.

nVidia GeForce 9400GT, 256.xx driver
linuxMint 9, 64-bit%%%

**Category**: Rendering %%%As an example here is an attached .blend containing a simple star 2d filter. Everything looks great -- but what are those ugly artifacts around the edge? Well it's obviously the controls from outside of the game window being pulled in. Probably it should be black out of the game window - or better - extended, but I don't know how it works. I don't want to check if the pixel it's computing with is in the game window because all the extra math and if then's slow down the filter. nVidia GeForce 9400GT, 256.xx driver linuxMint 9, 64-bit%%%
Author

Changed status to: 'Open'

Changed status to: 'Open'

%%%Hi,
without even looking at your file I can say: you have to learn how to deal with that. The BlenderPlayer handles that differently since there is no UI around it (therefore it will be black). Give it a try and write down here whether it still bothers you. Also, please be specific about what version of Blender you are using (2.49? 2.53? ...)

If you use glTexture- [x] you have a normalized coordinates running from 0,0 (bottom left) to 1,1 (top,right) of the canvas. You can use it to make sure you don't run into those problems.%%%

%%%Hi, without even looking at your file I can say: you have to learn how to deal with that. The BlenderPlayer handles that differently since there is no UI around it (therefore it will be black). Give it a try and write down here whether it still bothers you. Also, please be specific about what version of Blender you are using (2.49? 2.53? ...) If you use glTexture- [x] you have a normalized coordinates running from 0,0 (bottom left) to 1,1 (top,right) of the canvas. You can use it to make sure you don't run into those problems.%%%
Author

%%%Sorry, I'm using 2.5 revision 31445.
I haven't ever used the blender player thing, but if I make the 3dview the only view and get rid of headers, toolbars the problem goes away.
I will look into using glTexture- [x] and see if I can work around it.%%%

%%%Sorry, I'm using 2.5 revision 31445. I haven't ever used the blender player thing, but if I make the 3dview the only view and get rid of headers, toolbars the problem goes away. I will look into using glTexture- [x] and see if I can work around it.%%%
Author

%%%Clamping the texture coords to 0.0 and 1.0 clamps to the entire Blender window. Now, I'm sure I can make a script run at the start to set game properties with the offset of the game window, but would you agree the game window should have an isolated texture, or no?
Clamping to TexCoord- [x] give me the whole blender window in the game window, see texcoord3.png.%%%

%%%Clamping the texture coords to 0.0 and 1.0 clamps to the entire Blender window. Now, I'm sure I can make a script run at the start to set game properties with the offset of the game window, but would you agree the game window should have an isolated texture, or no? Clamping to TexCoord- [x] give me the whole blender window in the game window, see texcoord3.png.%%%
Author

%%%Dalai,

"If you use glTexture- [x] you have a normalized coordinates running
from 0,0 (bottom left) to 1,1 (top,right) of the canvas. You
can use it to make sure you don't run into those problems."

I still can't get this working since gl_TexCoord- [x] gives me across the whole window and gl_TexCoord- [x] gives me just the positions in the game window and I can't compare them somehow because I don't know where the game window is positioned and I can't get it with python either. How did you do it?%%%

%%%Dalai, "If you use glTexture- [x] you have a normalized coordinates running from 0,0 (bottom left) to 1,1 (top,right) of the canvas. You can use it to make sure you don't run into those problems." I still can't get this working since gl_TexCoord- [x] gives me across the whole window and gl_TexCoord- [x] gives me just the positions in the game window and I can't compare them somehow because I don't know where the game window is positioned and I can't get it with python either. How did you do it?%%%

%%%I gave a look at the shader and I see your problem. You need a way to find the gl_TexCoords- [x] equivalent to the calculated 'coords'. That's doable, but it works properly only in the bottom left window.

Take a look at this file, it has a few samples of how to use this. Including this convertion from gl_TexCoords- [x] to - [x] and the other way around.

http://projects.blender.org/plugins/scmsvn/viewcvs.php/trunk/lib/tests/gameengine_visual/GLSL_samples_249.blend?root=bf-blender&view=log

I agree that "the game window should have an isolated texture" but the real fix for that is really complicated (ATI behaves really different to NVidia on that matter). Maybe in Blender 2.5 that is easier to fix. I doubt it.%%%

%%%I gave a look at the shader and I see your problem. You need a way to find the gl_TexCoords- [x] equivalent to the calculated 'coords'. That's doable, but it works properly only in the bottom left window. Take a look at this file, it has a few samples of how to use this. Including this convertion from gl_TexCoords- [x] to - [x] and the other way around. http://projects.blender.org/plugins/scmsvn/viewcvs.php/trunk/lib/tests/gameengine_visual/GLSL_samples_249.blend?root=bf-blender&view=log I agree that "the game window should have an isolated texture" but the real fix for that is really complicated (ATI behaves really different to NVidia on that matter). Maybe in Blender 2.5 that is easier to fix. I doubt it.%%%

%%%Fixed in r48366. Let me know if you're still having problems (I'm closing this report for now, but it can be reopened).%%%

%%%Fixed in r48366. Let me know if you're still having problems (I'm closing this report for now, but it can be reopened).%%%

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#23375
No description provided.